widzę ten dziwny problem, i nie mogę znaleźć nic podobnego do tego w dowolnym miejscu na stronie:Dlaczego "K". Długość daje mi zły wynik?
int l = "K".Length; //This actually returns 2 !!! The 'Autos' window in
//the debugger also shows "K".Length as 2.
string s = "K";
l = s.Length; //Whereas this returns 1 as expected
Próbowałem to w różnych C# projektów, a nawet poprosił innego programistę, aby potwierdzić zachowanie jest identyczne w sposób inny projekt na innej maszynie.
Próbowałem to samo w VB.NET:
Dim l As Integer = "K".Length 'This returns 1 correctly
jestem tracąc go?
debugger za quickwatch na '„K”.Length' pokazuje 1. – AgentFire
Debugger bezpośrednim na'” K ".Length' pokazuje 1. – AgentFire
Czy to nie jest spacja przed K w pierwszym przykładzie? :) – koss