C
C#14mo ago
Pesar

❔ Disabling Top level statements in VSCode

Anyone know how I can disable top level statemnts in VSCode? I hate the top level statements
No description
38 Replies
Angius
Angius14mo ago
Just write the boilerplate if you like useless code this much
Thinker
Thinker14mo ago
You can just write a Program class and Main method and it'll work
Pesar
PesarOP14mo ago
the what no well I should rephrase I hate the top level statements since I learnt with the old code type Idk how to use the new tls
Angius
Angius14mo ago
Boilerplate, useless code in other words Just write class Program Add a void Main() to it Boom
Pesar
PesarOP14mo ago
ty how exactly do you use tls like how do ymou make new methods
Angius
Angius14mo ago
You just... do?
Mayor McCheese
Mayor McCheese14mo ago
just pretend you're in the main method
Pesar
PesarOP14mo ago
qwhat if I dont wanna be 😭 calling other methods or do you not have to do that in tls
Angius
Angius14mo ago
Then you write a method right there At the end of the file And call it Or you make a new file with a class and a method And use that
Mayor McCheese
Mayor McCheese14mo ago
public static void Main(string[] args) { // TLS is right here. }
Pesar
PesarOP14mo ago
Like this?
Pesar
PesarOP14mo ago
So
No description
Angius
Angius14mo ago
Yeah
Pesar
PesarOP14mo ago
I frogot how to request stuff or whatever in methods so uh
Angius
Angius14mo ago
Well, you'll need to type your parameters Or... give them a name Whichever it is that you didn't do But yes
Pesar
PesarOP14mo ago
I didnt do 10 what did I do skul
Pesar
PesarOP14mo ago
How do i give maaaa the name string
No description
Angius
Angius14mo ago
MethodName(type name, type name, type name)
Pesar
PesarOP14mo ago
oh my god sorry and thanks
Angius
Angius14mo ago
For example,
static int Sum(int first, int second)
{
return first + second;
}
static int Sum(int first, int second)
{
return first + second;
}
Pesar
PesarOP14mo ago
tyty wait so you're not supposed to leave the main method?
Pesar
PesarOP14mo ago
No description
Pesar
PesarOP14mo ago
OR
Pesar
PesarOP14mo ago
No description
Mayor McCheese
Mayor McCheese14mo ago
there are some magic in TLS that make things essentially end up like your first image you're sorta overthinking top level statements was my point.
Pesar
PesarOP14mo ago
i indeed am hm ty
Angius
Angius14mo ago
This is basically what the compiler does with top-level statements
No description
Thinker
Thinker14mo ago
that's a good gif
Mayor McCheese
Mayor McCheese14mo ago
compilers can do blinkys?
Pesar
PesarOP14mo ago
so SDK5 people are the compilers
Angius
Angius14mo ago
SDK5...?
No description
Pesar
PesarOP14mo ago
.net sdk 5 And that
Angius
Angius14mo ago
Uh, well, .NET 5 SDk does contain the compiler, yes Since C# is a compiled language... it does need a compiler I'm not sure if any of the people working on it are a compiler gained sentience, but I'd doubt that
Jimmacle
Jimmacle14mo ago
you never know
Thinker
Thinker14mo ago
Roslyn is indeed sentient
Mayor McCheese
Mayor McCheese14mo ago
chat gproslyn
Thinker
Thinker14mo ago
Fred and everyone else in #roslyn is just a figment of Roslyn
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server