using System.Threading.Tasks;
public static void Main()
var t1=Task.Run(()=>SingleTonExample.GetInstance.M1());
var t2=Task.Run(()=>SingleTonExample.GetInstance.M1());
public sealed class SingleTonExample
private static int counter=0;
private static SingleTonExample instance=null;
private static readonly object lockinc = new object();
public static SingleTonExample GetInstance
instance = new SingleTonExample();
Console.WriteLine("hello from M1");
private SingleTonExample()
Console.WriteLine("hello from ctor :{0}",counter);