标签:
public class Bean { public Bean() { } public static String Current { get { if (guid == null) guid = Guid.NewGuid().ToString(); return guid; } } public static String Current2 { get { if (guid2 == null) guid2 = Guid.NewGuid().ToString(); return guid2; } } [ThreadStatic] public static String guid; public static String guid2; }
for (int i = 0; i < 3; i++) { new Thread(() => { Console.WriteLine(Bean.Current.ToString()); Console.WriteLine(Bean.Current2.ToString()); }).Start(); }
标签:
原文地址:http://www.cnblogs.com/wujf/p/5205737.html