Namespace needed or not?
Hello. I am a python coder (still quite new) who wants to branch out to C# as it is used for Unity as well as has support for desktop and web applications if I so wish to go to that path... Issue is I hate VS and much rather use VSCode as its light weight and just looks better to me.. its what I am used to. I have the exstentions to run C# in VSCode but whenever I make a new project it doesn't give me the namespace and main class like in VS... are these needed in C#? I know what classes are but namespaces I don't as python doesn't use them? Can I just have a answer of what is a namespace and do I need it/the main class for C# code? I should also ask if its even "okay" to use VSCode for C#.. thanks
21 Replies
a) It's significantly more difficult to use VSCode than VS as a beginner, but you absolutely can.
b) The default project template do doesn't have the namespace and class because it's not needed anymore. This is a feature called top level statements which essentially allows you to write the body of
Main
at the top level of a file.so it acts like a python file.. reading from the top first
essentially yes
aright.. can u explain why its more difficult to use VSCode than VS?
You have to do a lot more work manually through the command line
VS does a whole lot for you
I don't think that's true with the new extensions
Though I have to say they have not been working at all for me...
like running files? making directories to store or is there more?
Like, at all
adding packages, publishing, handling project metadata
Also, a namespace is like a folder for putting classes inside. It's useful for organizing classes together, but it's technically not needed.
so its basically just a orangization
whats the word
method?
like having multiple files in python for different functions and parts of the program
Well, kinda
u said its mainly for classes
C# doesn't have a concept of "files"
mmh?
All files in a project are essentially just grouped together, on the project level files don't matter at all
So namespaces are how you organize classes in a project
so not needed.. but good idea to do it
Thanks for the information
I would much rather use VScode than VS... eating up 20GBs for no reason is stupidly annoying and having two seprate programs for 2 langauges.. is dumb and now im less confused about why VScode gives me a werid template.. thanks 🙂
!close
$close
Use the /close command to mark a forum thread as answered
"the apllication did not respond"
wha?
Ah I think it's having problems, you can close the thread manually though
mh?
Oh
yea
thx