注意:这是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
这里发生了什么?
谢谢
这确实是VS表达式评估器中的一个错误(由“即时窗口”使用)。对于Visual Studio 2015,该问题已得到修复(您可以在此处尝试最新的CTP,包括此修复程序)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句