[英]CS1525 - Invalid expression term '^'
I'm trying to get the console to print the last word in the following string array and added the code below:我试图让控制台打印以下字符串数组中的最后一个单词并添加以下代码:
static void Main(string[] args)
{
string[] words = new string[]
{
"Richard",
"Of",
"York",
"Gave",
"Battle",
"In",
"Vain"
};
Console.WriteLine($"The last word is {words[^1]}");
}
The compiler throws the error编译器抛出错误
Invalid expression term '^' for the '^' operator. '^' 运算符的表达式项 '^' 无效。
Any help will be much appreciated.任何帮助都感激不尽。
Install latest.Net SDK for your platform and/or update Visual Studio Download .NET SDKs为您的平台安装 latest.Net SDK 和/或更新 Visual Studio下载 .NET SDK
Make sure to have the latest .NET Core SDK installed, and also check the settings of your project.确保安装了最新的 .NET Core SDK,并检查项目的设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.