Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WinRT-为什么可以';这个字符串(字符数组)不是往返的吗?_C#_Unicode_Windows Runtime - Fatal编程技术网

C# WinRT-为什么可以';这个字符串(字符数组)不是往返的吗?

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

注意:这是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 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调用。这件事今天不会解决的。