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?
20 Replies
It's just a suggestion
What's in the body of your ctor? It's been hidden by the dialog
As in, you can do that, maybe you'd like it, it lets you have less code
Doesn't necessarily fix anything
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
Yep
At least in Rider
I was following a tutorial, his ide is showing this but mine isnt showing. @ZZZZZZZZZZZZZZZZZZZZZZZZZ @canton7
Again, show the body of the ctor please...
Make sure your VS is up to date
And that your project is .NET 8, C# 12
That's when primary ctors were added
I have C# 12, I disabled the co-pilot and IDE Dev Kit isn't showing the quick fix maybe.
Please don't ignore me. I'm trying to help
Ah, you're using VS Code?
And, yeah, show the body of your ctor
@canton7
OK, that should be fine
@canton7 what should I do now
@ZZZZZZZZZZZZZZZZZZZZZZZZZ Yes I am using vs code 22
Why did you mention DevKit then?
It's an extension
For Visual Studio Code
There's no VS Code 2022
There's VS 2022
oh sorry, Beginners things.
Sure thing
If you can, use VS 2022, not VS Code
Alright