sto vedendo questo strano problema, e non riesce a trovare nulla di simile a questo ovunque sul web:Perché "K" .Lunghezza mi dà risultati errati?
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
ho provato questo in vari progetti C# e anche chiesto un altro sviluppatore per confermare il comportamento è identico in un progetto diverso su una macchina diversa.
ho provato lo stesso in VB.NET:
Dim l As Integer = "K".Length 'This returns 1 correctly
Perchè sono perderla?
"Quick" del debugger's "" K ".Length' mostra 1. – AgentFire
Immediato del debugger' " K ".Lunghezza' mostra 1. – AgentFire
Non è uno spazio prima di K nel primo esempio? :) – koss