What are the rules to initialization order in C#?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1405709/what-is-the-static-variable-initialization-order-in-c">What is the static variable initialization order in C#?</a>  </p>
</blockquote>



<p>For fun i ran <a href="http://ideone.com/d1heM" rel="nofollow">this code</a> </p>

<p>I was not expecting <code>2 2 3</code>. I was expecting a compiler error (circlur dependency) or <code>8 5 3</code>.</p>

<p>What are the rules to initialization order in C#?</p>

<p>-edit- <a href="http://ideone.com/mn3Um" rel="nofollow">i tried making a not static</a> and i got what i expected. Why is b 2 before and now 5. I don't think i'm going to like the rules... Luckily i never do anything like this so i haven't had a problem.</p>

<pre><code>using System;

public class Test
{
        public static void Main()
        {
                A.t();
        }
}

class A
{
    static int a = B.b + c;
    public static int c = 3;
    static public void t()
    {
        Console.WriteLine("{0} {1} {2}", a, B.b, c);
    }
}
class B
{
    public static int b = A.c+2;
}
</code></pre>
