<p>The following snippet of C# code:</p>

<pre><code>  int i = 1;
  string result = String.Format("{0},{1},{2}", i++, i++, i++);
  Console.WriteLine(result);
</code></pre>

<p>writes out: 1,2,3</p>

<p>Before I tried this in the compiler I was expecting the assignments to take place and then the evaluations, so my expected output was: 1,1,1</p>

<p>So my question is: Does this "pattern" (is it called a pattern?) of assign and then evaluate each parameter have a name?</p>

<p>EDIT: I'm referring to the pattern of evaluating and assigning the parameters to the String.Format() function. Not the incrementing of i.</p>

<p>(I may be incorrectly using the word evaluate in the question above because if the parameter was say (i + j) then we know that it would be evaluated before it was assigned. When using the word evaluate in that context I'm referring to the incrementing of i.)</p>

The
order of evaluation
of arguments is strictly left-to-right in C#.  When you evaluate the expression
```
i++
```
, what happens is the value of
```
i
```
is calculated and pushed, then the value of
```
i
```
is incremented.
The ++ operator on System.Int32 is effectively a function with the special name
```
++
```
and the special syntax of calling it by writing a reference to a variable and then the characters ++.
So in effect, what you wrote is
```
```
// assume this function is defined:
int Inc(ref int i)
{
  var old = i;
  i = i + 1;
  return old;
}

...
int i = 1;
string result = String.Format("{0},{1},{2}", Inc(ref i), Inc(ref i), Inc(ref i));
Console.WriteLine(result);
...
```
```
Since arguments are evaluated left-to-right,
```
Inc(ref i)
```
is called 3 times, each time incrementing
```
i
```
after passing the current value of
```
i
```
to
```
String.Format(...)
```
.  This is exactly what happens in your code, as well.