You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
string s = "123";
var sb = new StringBuilder();
sb.Append(s[0]);
int x = int.Parse(sb.ToString()); // here x is not 1 but 31(ASCII)
when sb.Append(s[0]); s[0] is cast to byte by string:byte(), then int.Parse will consider it as a number type and get 31.
the problem is when c# call sb.Append(char c) and sb.Append(int x), c is just append at end of buffer but x will convert to string. but in lua, s[0] always return a number, and lua can not distinguish char and int here.
solution:
during transfor ast, type info can retrieve from roslyn in sb.Apppend(TYPE t), here type cast may needed when c# call ToString automatically.
The text was updated successfully, but these errors were encountered:
when sb.Append(s[0]); s[0] is cast to byte by string:byte(), then int.Parse will consider it as a number type and get 31.
the problem is when c# call sb.Append(char c) and sb.Append(int x), c is just append at end of buffer but x will convert to string. but in lua, s[0] always return a number, and lua can not distinguish char and int here.
solution:
during transfor ast, type info can retrieve from roslyn in sb.Apppend(TYPE t), here type cast may needed when c# call ToString automatically.
The text was updated successfully, but these errors were encountered: