1 List< long> list = new List<long>(); 2 List<Task> tList = new List<Task>(); 3 tList.Add(Task.Factory.StartNew(() => 4 { 5 for (int i = 0; i < 100; i++) 6 { 7 list.Add(Snowflake.Instance().GetId()); 8 } 9 })); tList.Add(Task.Factory.StartNew(() => 10 { 11 for (int i = 0; i < 100; i++) 12 { 13 list.Add(Snowflake.Instance().GetId()); 14 } 15 })); 16 17 Task.WaitAll(tList.ToArray()); 18 list.ForEach(p => Console.WriteLine(p));