????????????
???????????????????????
?????????????????????????????????
???????????????????????
??????д????????????? var list = ImmutableList.Empty.Add(10).Add(20).Add(30);
???????????????????????
???????????????
????????????????????????ζ???/?????????????????????????????????????????????м???????????GC???????????????????伯?????
??????string??StringBuild?????Net???????伯???????????????????API?????????????????????
????ImmutableList<string> immutable = ImmutableList<string>.Empty;
????//???????????????????
????var immutable2 = immutable.ToBuilder();
????immutable2.Add("xx");
????immutable2.Add("xxx");
????//????????伯??
????immutable = immutable2.ToImmutable();
????????????????伯????????Builder?????????伯????????????????1000W?Σ?

?????????????£?
private static void List()
{
var list = new List<object>();
var sp = Stopwatch.StartNew();
for (int i = 0; i < 1000 * 10000; i++)
{
var obj = new object();
list.Add(obj);
}
Console.WriteLine("????б????:"+sp.Elapsed);
}
private static void BuilderImmutableList()
{
var list = ImmutableList<object>.Empty;
var sp = Stopwatch.StartNew();
var blist= list.ToBuilder();
for (int i = 0; i < 1000 * 10000; i++)
{
var obj = new object();
blist.Add(obj);
}
list=blist.ToImmutable();
Console.WriteLine("?????Builder?б????:"+sp.Elapsed);
}
private static void ImmutableList()
{
var list = ImmutableList<object>.Empty;
var sp = Stopwatch.StartNew();
for (int i = 0; i < 1000 * 10000; i++)
{
var obj = new object();
list = list.Add(obj);
}
Console.WriteLine("??????б????:" + sp.Elapsed);
}
???????????????????????в????????? ????string???????????????????????string???????????????????????
???????????? var pwd=”mushroomsir”????????????????洢??????У?????????????????????????????????????????????洢???????????У??κ??????dump???????????????????????????????????????
????????????????????net2.0??????SecureString?????а???洢?????????л?????????
????IntPtr addr = Marshal.SecureStringToBSTR(secureString);
????string temp = Marshal.PtrToStringBSTR(addr);
????Marshal.ZeroFreeBSTR(addr);
????WriteProcessMemory(...)