i thought it might be helpfull to start a thread where we can discuss common questions about c#. the essence of this q&a could then form a wikipage like c# FAQ.
so, i’ll start with a small question:
there are two ways to declare variables below. is one of them the better/faster solution?
hello sebl, tha ‘var’ keyword is for lazy people, you can use it wherever the compiler knows exactly which type you mean. it will be replaced with the right type before compilation, so the resulting machine code will be exactly the same.
while its not faster to write ‘var’ instead of ‘int’, it helps when class names are long:
code(lang=csharp):
MyLongClassName c = new MyLongClassName();