I have two strings.
one is "\""
and the other is "\""
I think that they are same.
However, String.Compare
says they are different.
This is very strange.
Here's my code:
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");
}
I expected that it may print "GoodCB".
However, it only prints "B".
In my debugger, c[0]
is 65279 '' and c[1]
is 34 '"'. and b[0]
is '"'.
But I don't know what 65279 '' is.
Is it an empty character?
StreamReader
if thestring
was loaded from aStream
, useEncoding.GetString()
if it was loaded fromEncoding.GetBytes()
; do not mix the two): https://mcmap.net/q/93688/-encoding-utf8-getstring-doesn-39-t-take-into-account-the-preamble-bom – Phosphorism