We can:
var t=new String(new[] { '็น', '้ซ', 'ไธญ', 'ๆ' });
or
var encoding=Encoding.Unicode; var bytes=encoding.GetBytes(new[] { 'E', 'n', 'g', 'l', 'i', 's', 'h' }); var t=encoding.GetString(bytes);
No comments:
public static implicit operator String(char[] charArray) { return new String(charArray); }
We can not:
String t=new[] { '', '', '', '', '', '', '', '\x20', '', '', '', '' };
I know that the character array does not match the string ; but sometimes I just want to assign an array of characters to a string directly; without explicit casting, conversion, or new X(new Y(new Z ...
And I think, personally, the reason why it was not submitted, perhaps because:
The C-Sharp team wants programmers, especially those with experience with C ++ / C, to remember that C-Sharp is NOT the same as C ++ or C.
The question is why not? This is bad?