-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathProgram.cs
38 lines (33 loc) · 953 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
namespace InitializationOrderWithCircularDependencies
{
public class AfterYou
{
static AfterYou()
{
Console.WriteLine("AfterYou static constructor starting");
Console.WriteLine("AfterYou: NoAfterYou.Value = " + NoAfterYou.Value);
Value = 123;
Console.WriteLine("AfterYou static constructor ending");
}
public static int Value = 42;
}
public class NoAfterYou
{
static NoAfterYou()
{
Console.WriteLine("NoAfterYou static constructor starting");
Console.WriteLine("NoAfterYou: AfterYou.Value: = " + AfterYou.Value);
Value = 456;
Console.WriteLine("NoAfterYou static constructor ending");
}
public static int Value = 42;
}
class Program
{
static void Main()
{
Console.WriteLine(AfterYou.Value); ;
}
}
}