✅ 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
SpReeD7mo ago
Do you have ImplicitUsings on enable?
SleepWellPupper
SleepWellPupper7mo ago
What happens when you remove it?
SpReeD
SpReeD7mo 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
SleepWellPupper7mo ago
That's my thinking too.
daniswastaken
daniswastakenOP7mo ago
the code still running perfectly fine even if don't use the using statements how to disable it?
SpReeD
SpReeD7mo ago
<ImplicitUsings>disable</ImplicitUsings> in your *.csproj file
daniswastaken
daniswastakenOP7mo ago
oh wow, that is works bro that was easy thank you so much
daniswastaken
daniswastakenOP7mo 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
Becquerel7mo ago
that probably means you're not using the args argument
daniswastaken
daniswastakenOP7mo ago
im just using the Console.WriteLine, is that normal?
Becquerel
Becquerel7mo ago
it's fine to not use it, to be clear vs code is just informing you in case it was a mistake
SpReeD
SpReeD7mo 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
daniswastakenOP7mo ago
okay, thank you man for helping appreciate it
Becquerel
Becquerel7mo ago
no prob
SleepWellPupper
SleepWellPupper7mo ago
Fyi, you can omit string[] args from the Main method signature. It's optional but the template contains it by default.
daniswastaken
daniswastakenOP7mo ago
okay, thank you for the information
SleepWellPupper
SleepWellPupper7mo ago
$close
MODiX
MODiX7mo 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