C# "discovery" return type feature

.net, c#, var

Solution

`var` is used for `implicitly typing` variables.

It happens at compile time. There is no performance issue.

- See this MSDN article about `var`

- Or this one on implicitly typed variables

Examples:

var i = 12; // This will be compiled as an integer
var s = "Implicitly typed!"; // This will be compiled as a string
var l = new List<string>(); // This will be compiled as a List of strings

Problem

in c#, when returning a value, it is not nescessary to specify the variable type. For instance: ``` foreach(var variable in variables) { } ``` I am building a corporate software that today is a small solution but it is going to be big. This language feature could decrease performance as we use it over and over on our application? I have not found how this feature is called and I would like to know more about it, how it is called?

Original source