C# WinRT-为什么可以';这个字符串(字符数组)不是往返的吗?
注意:这是Windows RT!我很惊讶这不起作用,所以我在LinqPad尝试了它,它很好 查看VS立即窗口的输出:C# WinRT-为什么可以';这个字符串(字符数组)不是往返的吗?,c#,unicode,windows-runtime,C#,Unicode,Windows Runtime,注意:这是Windows RT!我很惊讶这不起作用,所以我在LinqPad尝试了它,它很好 查看VS立即窗口的输出: string str = "503"; "503" var charArray = str.ToCharArray(); {char[3]} [0]: 53 '5' [1]: 48 '0' [2]: 51 '3' string str2 = new String(charArray); 'new String(charArray)' threw an
string str = "503";
"503"
var charArray = str.ToCharArray();
{char[3]}
[0]: 53 '5'
[1]: 48 '0'
[2]: 51 '3'
string str2 = new String(charArray);
'new String(charArray)' threw an exception of type 'System.ArgumentException'
new String(charArray);
'new String(charArray)' threw an exception of type 'System.ArgumentException'
base: {"Value does not fall within the expected range."}
m_paramName: null
Message: "Value does not fall within the expected range."
ParamName: null
这是怎么回事
感谢Dirk指出,当在Windows应用商店应用程序中进行编码时,它实际上会执行。我把它归类为VS IDE中的一个bug
这确实是VS表达式计算器(由即时窗口使用)中的一个错误。Visual Studio 2015已经解决了这个问题(您可以试用最新的CTP,包括修复程序)。不会给我带来异常。顺便问一下,你们的环境是什么?是的。我可以在调试器的即时窗口中复制它。执行起来很正常。太棒了,你说得对。我将提交一个连接错误。这不是特定于RT或特定构造函数的。注意
如何创建新字符串(“”,3)代码>以同样的方式失败。请记住,即时窗口不使用完整的编译器,Roslyn在VS next之前不会出现。我怀疑这是一个限制,因为这些构造函数是内部CLR调用。这件事今天不会解决的。