✅ Using statement still grayed out even if it in use [SOLVED]

So I had this problem with bot VSCode and VS where the using statement (using System;) is still grayed out even if it in use, is there any solution?
No description
18 Replies
SpReeD
SpReeD2mo ago
Do you have ImplicitUsings on enable?
SleepWellPupper
SleepWellPupper2mo ago
What happens when you remove it?
SpReeD
SpReeD2mo ago
It probably compiles, the gray out means it's unnecessary; almost for certain that ImplicitUsings are on, since it's enabled by default in the latest project template, along with Nullable.
SleepWellPupper
SleepWellPupper2mo ago
That's my thinking too.
daniswastaken
daniswastaken2mo ago
the code still running perfectly fine even if don't use the using statements how to disable it?
SpReeD
SpReeD2mo ago
<ImplicitUsings>disable</ImplicitUsings> in your *.csproj file
daniswastaken
daniswastaken2mo ago
oh wow, that is works bro that was easy thank you so much
daniswastaken
daniswastaken2mo ago
uh wait, does this line is actually being grayed out or is there something else disabled? im sorry im a newbie at programming
No description
Becquerel
Becquerel2mo ago
that probably means you're not using the args argument
daniswastaken
daniswastaken2mo ago
im just using the Console.WriteLine, is that normal?
Becquerel
Becquerel2mo ago
it's fine to not use it, to be clear vs code is just informing you in case it was a mistake
SpReeD
SpReeD2mo ago
The parameter isn't used, but, since this is a console app (my guess), it should have the args parameter to support cli arguments.
daniswastaken
daniswastaken2mo ago
okay, thank you man for helping appreciate it
Becquerel
Becquerel2mo ago
no prob
SleepWellPupper
SleepWellPupper2mo ago
Fyi, you can omit string[] args from the Main method signature. It's optional but the template contains it by default.
daniswastaken
daniswastaken2mo ago
okay, thank you for the information
SleepWellPupper
SleepWellPupper2mo ago
$close
MODiX
MODiX2mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Want results from more Discord servers?
Add your server
More Posts