C
C#•2y ago
UnFuzed

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
Thinker
Thinker•2y ago
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.
UnFuzed
UnFuzedOP•2y ago
so it acts like a python file.. reading from the top first
Thinker
Thinker•2y ago
essentially yes
UnFuzed
UnFuzedOP•2y ago
aright.. can u explain why its more difficult to use VSCode than VS?
Thinker
Thinker•2y ago
You have to do a lot more work manually through the command line VS does a whole lot for you
ero
ero•2y ago
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...
UnFuzed
UnFuzedOP•2y ago
like running files? making directories to store or is there more?
ero
ero•2y ago
Like, at all
Thinker
Thinker•2y ago
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.
UnFuzed
UnFuzedOP•2y ago
so its basically just a orangization whats the word method? like having multiple files in python for different functions and parts of the program
Thinker
Thinker•2y ago
Well, kinda
UnFuzed
UnFuzedOP•2y ago
u said its mainly for classes
Thinker
Thinker•2y ago
C# doesn't have a concept of "files"
UnFuzed
UnFuzedOP•2y ago
mmh?
Thinker
Thinker•2y ago
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
UnFuzed
UnFuzedOP•2y ago
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
SinFluxx
SinFluxx•2y ago
$close
MODiX
MODiX•2y ago
Use the /close command to mark a forum thread as answered
UnFuzed
UnFuzedOP•2y ago
"the apllication did not respond" wha?
SinFluxx
SinFluxx•2y ago
Ah I think it's having problems, you can close the thread manually though
UnFuzed
UnFuzedOP•2y ago
mh? Oh yea thx

Did you find this page helpful?