|
发表于 2023-1-18 01:08:10
|
显示全部楼层
string s1 = null 和 string s1 = "" 在编译成IL后是一致的,但是string s1 = Sring.Empty 在IL 中会进栈,所以,到底有什么区别呢?
string s1 = null;
string s2 = "";
string s3 = String.Empty;
IL_0000: ldsfld string [System.Private.CoreLib]System.String::Empty
IL_0005: pop |
|