Last active
May 23, 2017 10:53
-
-
Save EgorBo/6bcd2719209e5dd7470aaa65b8d89ead 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(); | |
public Foo() | |
{ | |
Console.WriteLine("Foo init."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment