Var keyword in Delphi/Oxygene and C#

I had the privilege of working on some of the interesting languages like Delphi, Oxygene, C# etc.

All the languages listed above has the keyword var which worked slightly different in each of the languages.

In Delphi and Oxygene, one can use var keyword to pass the parameter by reference as well as to start the block of variable initialization within the method.

method MainForm.Function1;


message1 : String;


message1 := "Welcome to";

load(var message1);



method MainForm.load(var data: String);


data := "This is a test application";


In C#, the var keyword denotes an anonymous type. When you want to assign a variable, you need not specify the type but instead specify it as var, C# finds out what is the resulting type. One of the most common use of the var keyword in C# is in the LINQ query.

Check the 5 Things That You Cannot do with a Local Type Inference In C# to know more about var keyword in C#