C# faq

Hellllo

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?

int a = 0;

or

var a = 0;

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();

var c = new MyLongClassName();

is there an easy way to do threading with the new plugininterface?

… so that things could run in the background, like Dir (File Advanced) does