我有两个字符串.
一个是"\""
另一个是"\""
我认为他们是一样的.
然而,String.Compare他们说是不同的.
这很奇怪.
这是我的代码:
string b = "\"";
string c = "\"";
if (string.Compare(b, c) == 0)
{
Console.WriteLine("Good");
}
if (c.StartsWith("\""))
{
Console.WriteLine("C");
}
if (b.StartsWith("\""))
{
Console.WriteLine("B");
}
Run Code Online (Sandbox Code Playgroud)
我预计它可能会打印"GoodCB".
但是,它只打印"B".
在我的调试器中,c[0]是65279''并且c[1]是34'''.并且b[0]是'''.
但我不知道65279'是什么.
这是一个空洞的角色吗?