Created
May 23, 2017 14:14
-
-
Save EgorBo/aa3ac66bef7977d7c6bff1195cf9226c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace StaticTest | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
//args are empty but .NET and MONO will init Foo anyway, .NET core - won't. | |
var obj = args.Length > 0 ? Foo.Instance : null; | |
Console.WriteLine(obj); | |
} | |
} | |
public class Foo | |
{ | |
public static Foo Instance = new Foo(); | |
//static Foo() {} | |
public Foo() | |
{ | |
Console.WriteLine("Foo init."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment