Hi, programmers!
there's global and local variables ? I've heard about common variables....what is it ?
Does anybody know? if so - please - share your knowledge!
Thanks in advance !

Hi there vedro-compota,

Variables exist within the scope of their creation.
Make a variable within a class, and that's its scope.
Make a variable within a method, and that's its scope.
So make it within the program, but outside of any one class.
If you make it in the program.cs file, and make it public then any class within the program can access it as... (source)

commented: ++++++++ +1

Thank you,Mitja ! but if so - what the difference between global and common variables?

Vedro - lets put it this way: You are on the beginning of your programming path, if Iam not mistaking. So, if you know what is local and global variable, will do good for the next a couple of years. Belive me. I`m coding for a 2,5 years and havent encountered any need or something of using common varibale.
Truly, I dont even need a common varible (even if I dont actually know what this is, or if it exists).
So, if you know local and global variables, and you know how to operate and use them, is more then enough.

Mitja )) you're right! but i think - it's interesting.........))

back to the books vedro :)
btw, I have a good one for you if you want to learn: C# TheComplete Reference

Mitja Bonca - thanks you very much )) I hope there's something about common variables inthis book)) although it is more about general programming theory)))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.