Il seguente codice compilato correttamente:Perché non posso usare una nuova stringa nel debugger?
string foo = new string(new char[] { 'b', 'a', 'r' });
Il seguente codice non riesce a valutare se incollato nella finestra di controllo o la finestra immediata:
new string(new char[] { 'b', 'a', 'r' });
Il messaggio di errore è:
'new string(new char[] { 'b', 'a', 'r' })' threw an exception of type 'System.ArgumentException'
base {System.SystemException}: {"Only NewString function evaluation can create a new string."}
Message: "Only NewString function evaluation can create a new string."
ParamName: null
Perché succede?
Sede [questo post del blog ] (http://dotnetdust.blogspot.com/2009/03/string-construtor-stringchar-value.html). – cdhowie
Questo è ora "corretto" in VS 2015, sto supponendo perché usa Roslyn. –