c# - 这个箭头符号有什么问题?
问题描述
我在 c# 中有以下文件,我正在使用 VS 2013,但我卡在“=>”符号上,VS 总是要求输入“;” 在以下文件中的“=>”符号之后:
namespace GlobomanticsElectricCompany.BillProcessor.Models
{
public class ContactInfo
{
public string Line1 { get; set; }
public string Line2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zip { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
public string CityStateZip => $"{City}, {State} {Zip}";
}
}
我应该怎么做才能让 VS 识别那个“=>”符号?
解决方案
我最近遇到了这个问题;我不相信 => 语法在该版本的 Visual Studio 中有效。尝试像这样定义它:
public string CityStateZip
{
get
{
return City + " , " + State + " " + Zip;
}
}
推荐阅读
- asp.net-core - Visual Studio 2017 中的 asp net core 2.2.202 问题
- docker - 如何在一个 Istio 服务网格中托管多个应用程序?
- java - Android - 连接到蓝牙模块
- hybris - Hybris SmartEdit - 仅授予用户对一个内容页面的编辑权限
- junit - 有序启动和等待容器
- java - 运行 sprint boot 应用程序时如何从依赖 jar 中排除文件?
- android - 获取 503 服务不可用 - Firebase 远程配置
- android - Android Studio 更新到 3.3 后的奇怪 XML 格式。如何获取 xml 的 android 样式格式?
- eclipse - 如何在eclipse中安装jasmine
- javascript - Node.js 中的 Tobi 示例