using System;
using System.Numerics;
using System.Text;
class MyClass {
static void Main(string[] args) {
string str;
char[] str1=str.ToCharArray();
foreach (char c in inputArray)
{
if (char.IsLower(c))
str += char.ToUpper(c);
else
str += char.ToLower(c);
}
System.Console.WriteLine("str");
}
}
错误:TMP/CSHARP_30f1_944d_bf85_a405_1481953523/editor_source_509c_cad9_9662_9111_1481953523.cs(8,23):错误CS0103:名称`inputArray”不在当前上下文中存在编译失败:1个错误,0警告转换上浇铸到铸下部和下铸到上部铸于C#
你不需要做任何事情,c#有一个字符串大写的函数https://msdn.microsoft.com/en-us/library/ewdd6aed(v=vs.110).aspx。你的例外是因为'inputArray'没有被声明,如果你阅读它就很明显。 –
在声明中使用str1并在循环复制代码中使用输入数据异味 – Lucifer