I have string like that:
Now I have loop that removes 1st character if this first character's numeric value 65279
while (!string.IsNullOrEmpty(json) && json[0] == 65279)
{
json = json.Substring(1, json.Length - 1);
}
return json;
I have break point at first {
so before Substring
is executed
and now in watch window I type json[0] == 65279
and it returns FALSE
despite that it must have returned TRUE
in order to enter that loop!
what's going on here?
BTW: I'm aware that the same goal can be achieved with
.TrimStart(new char[] { Convert.ToChar(65279) });
instead of loop
Repro code:
var json = $"{Convert.ToChar(65279)}{Convert.ToChar(65279)}{{";
Console.WriteLine(json[0] == 65279);