-
Notifications
You must be signed in to change notification settings - Fork 203
Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels