C
C#7mo ago
Bilal

Converting the simple constructor to primary constructor

My vs code is not showing me the quick fix to convert this into primary constructor. how the fix this problem?
No description
20 Replies
Angius
Angius7mo ago
It's just a suggestion
canton7
canton77mo ago
What's in the body of your ctor? It's been hidden by the dialog
Angius
Angius7mo ago
As in, you can do that, maybe you'd like it, it lets you have less code Doesn't necessarily fix anything
canton7
canton77mo ago
I haven't played with that quick fix, but my guess it shtat it only appears when your ctor can be converted to a primary ctor. If it does things which a primary ctor wouldn't be able to do, it won't give you the suggestion
Angius
Angius7mo ago
Yep At least in Rider
Bilal
Bilal7mo ago
I was following a tutorial, his ide is showing this but mine isnt showing. @ZZZZZZZZZZZZZZZZZZZZZZZZZ @canton7
No description
canton7
canton77mo ago
Again, show the body of the ctor please...
Angius
Angius7mo ago
Make sure your VS is up to date And that your project is .NET 8, C# 12 That's when primary ctors were added
Bilal
Bilal7mo ago
I have C# 12, I disabled the co-pilot and IDE Dev Kit isn't showing the quick fix maybe.
canton7
canton77mo ago
Please don't ignore me. I'm trying to help
Angius
Angius7mo ago
Ah, you're using VS Code? And, yeah, show the body of your ctor
Bilal
Bilal7mo ago
@canton7
No description
canton7
canton77mo ago
OK, that should be fine
Bilal
Bilal7mo ago
@canton7 what should I do now @ZZZZZZZZZZZZZZZZZZZZZZZZZ Yes I am using vs code 22
Angius
Angius7mo ago
Why did you mention DevKit then?
Bilal
Bilal7mo ago
It's an extension
Angius
Angius7mo ago
For Visual Studio Code There's no VS Code 2022 There's VS 2022
Bilal
Bilal7mo ago
oh sorry, Beginners things.
Angius
Angius7mo ago
Sure thing If you can, use VS 2022, not VS Code
Bilal
Bilal7mo ago
Alright