private static Singleton1 instance = new Singleton1();
public static Singleton1 Instance
{
get
{
return instance;
}
}
}
public sealed class Singleton2
{
Singleton2()
{
Console.WriteLine("Singleton2 constructed");
}
public static void Print()
{
Console.WriteLine("Singleton2 Print");
}
public static Singleton2 Instance
{
get
{
return Nested.instance;
}
}
class Nested
{
static Nested() { }
internal static readonly Singleton2 instance = new Singleton2();
}
}