How to rewrite this Java snippet in C#
<p>This Java snippet apparently does what I want my C# snippet to do. I don't know Java well enough to get it to work. Could someone help me rewrite it in C#?</p>

<pre><code>int sum = 0, a[] = {2, 4, 6, 8};
for(int i: a) sum += i;
System.out.println("sum(a) = " + sum);
</code></pre>
