C
C#2y ago
Unkewn

❔ No path

Hi, im learning some C# code from yt channel Brackeys and when he has openned vs studio, u can see the path like "Using System"(i will send ss) but i dont have that on my file, what should i do, cause i dont know how im gonna use methods without it. Dont mind the text on mine ss, just wanna remember these things 😄
15 Replies
Thinker
Thinker2y ago
You can pretty much copy+paste the code from the tutorial and it'll be fine. This is a feature called "implicit usings" which just entails that you don't have to write using System; at the top of your files because it's added automatically in the background.
TheRanger
TheRanger2y ago
top level statement checkbox was probably on when u created the project
Thinker
Thinker2y ago
that too Top-level statements are a feature which allows you to not have to have the class Program and static void Main(string[] args) stuff. But again, you can just use the code from the tutorial.
Unkewn
UnkewnOP2y ago
oh thanks, i just propably missed type somewhere in the code
Unkewn
UnkewnOP2y ago
Unkewn
UnkewnOP2y ago
cause it was showing some error before
Null
Null2y ago
Oh god do not learn c# from brackys xD
vl4do
vl4do2y ago
why not
Null
Null2y ago
the c# vids are absolute dumpster fire and bad coding practices.
circles.png
circles.png2y ago
format your code + you cannot put methods in a top-level statements file
TheRanger
TheRanger2y ago
better stop concatenating 2 strings with + and start learning string interpolation
Console.WriteLine($"I'm {age} years old.");
Console.WriteLine($"I'm {age} years old.");
the dollar sign has to be inserted before the first quotation so that {age} transforms into it's value
Unkewn
UnkewnOP2y ago
Wow I didn't know about this, will do ?
circles.png
circles.png2y ago
there is bad indentation and you should move all this code to a Main method in a class
Thinker
Thinker2y ago
you can absolutely have methods in top-level statement files they just have to come after all statements
Accord
Accord2y 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