How using “var” variables impacts C# applications performance?

When coding I use var variables a lot. One day I  just got curious, how use of var variables impacts C# applications performance, if it impacts at all? Let’s check out by doing quick demo application. For comparing common intermediate language (CIL) code let’s use LinqPad.

As you can see from example, use of string or var variables generates same, identical CIL code. It’s good to know, that use of var does not impact C# applications performance, but makes code a little bit less noisy.

Leave a Reply

Your email address will not be published. Required fields are marked *