Skip to content

Instantly share code, notes, and snippets.

@BillWagner
Created September 5, 2013 20:47
Show Gist options
  • Save BillWagner/6455955 to your computer and use it in GitHub Desktop.
Save BillWagner/6455955 to your computer and use it in GitHub Desktop.
This shows that the evaluation order of parameters is dictated by their order all that call site, not the order in the function definition.
class Program
{
static void Main(string[] args)
{
int i = 5;
EvalOrder(++i, i++); // 6, 6
Console.WriteLine(i); // 7
EvalOrder(second: ++i, first: ++i); // 9, 8
Console.WriteLine(i); // 9
}
static void EvalOrder(int first, int second)
{
Console.WriteLine("First: {0}, Second: {1}", first, second);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment