C# syntax – Colon after a variable name

The colon is necessary to indicate parameters. In C# 4.0, you can re-order and name your parameters, optionally, but the variable name must match the prototype and have the colon postfix.

public void Test(string something1, string something2)
{
}

can be called as:

Test(something2: "bar", something1: "foo");

if you want

Leave a Comment