C
C#14mo 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
Thinker14mo 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
TheRanger14mo ago
top level statement checkbox was probably on when u created the project
Thinker
Thinker14mo 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
Unkewn14mo ago
oh thanks, i just propably missed type somewhere in the code
Unkewn
Unkewn14mo ago
Unkewn
Unkewn14mo ago
cause it was showing some error before
Null
Null14mo ago
Oh god do not learn c# from brackys xD
vl4do
vl4do14mo ago
why not
Null
Null14mo ago
the c# vids are absolute dumpster fire and bad coding practices.
circles.png
circles.png14mo ago
format your code + you cannot put methods in a top-level statements file
TheRanger
TheRanger14mo 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
Unkewn14mo ago
Wow I didn't know about this, will do ?
circles.png
circles.png14mo ago
there is bad indentation and you should move all this code to a Main method in a class
Thinker
Thinker14mo ago
you can absolutely have methods in top-level statement files they just have to come after all statements
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.