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