Mar*_*ell 10
我希望如此,是的.快速测试同意(但这不是证据):
string a = "abc", b = a.ToLower();
bool areSame = ReferenceEquals(a, b); // false
Run Code Online (Sandbox Code Playgroud)
一般情况下,尝试使用您想要的比较器.例如,如果您需要不区分大小写的字典,请使用以下字典:
var lookup = new Dictionary<string, int>(
StringComparer.InvariantCultureIgnoreCase);
Run Code Online (Sandbox Code Playgroud)
同样:
bool ciEqual = string.Equals("abc", "ABC",
StringComparison.InvariantCultureIgnoreCase);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1159 次 |
| 最近记录: |