简体   繁体   English

class、结构或接口成员声明中的无效令牌“令牌”

[英]Invalid token 'token' in class, struct, or interface member declaration

I'm trying to create the following Class:我正在尝试创建以下 Class:

public decimal base { get; set; }

and I get the error mentioned.我得到了提到的错误。 Any solution please?请问有什么解决办法吗? Thank you.谢谢你。

I'm trying to create the following Class and I get the error mentioned.我正在尝试创建以下 Class,但出现了上述错误。 Any solution please?请问有什么解决办法吗? Thank you谢谢

If you want the value to map to it, you need to add the 'JsonProperty' attribute indicating the name of the property.如果你想让它的值为 map,你需要添加 'JsonProperty' 属性来指示属性的名称。

[JsonProperty("base")]
public decimal Base { get; set; }

base is a special C# keyword. base是一个特殊的 C# 关键字。

Anyways, public properties should begin with uppercase letter:无论如何,公共属性应该以大写字母开头:

public decimal Base { get; set; }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 令牌无效 ';' 在类,结构或接口成员声明中 - Invalid token ';' in class, struct, or interface member declaration 令牌无效 ';' 在类struct或接口成员声明中 - invalid token ';' in class struct or interface member declaration 类,结构或接口成员声明中的令牌'='无效 - Invalid Token '=' in class,struct or interface member declaration 类、结构或接口成员声明中的无效标记 - Invalid token in class, struct, or interface member declaration 类、结构或接口成员声明中的无效标记“}” - Invalid token '}' in class, struct, or interface member declaration 类、结构或接口成员声明中的无效标记“)”和“{” - Invalid token ')' and '{' in class, struct, or interface member declaration 类,结构或接口成员声明中的标记'='无效,类,结构或接口成员声明中的无效标记'(' - Invalid token '=' in class, struct, or interface member declaration, Invalid token '(' in class, struct, or interface member declaration 我在类,结构或接口成员声明中收到错误的无效令牌'{' - i get error Invalid token '{' in class, struct, or interface member declaration 类,结构或接口成员声明中的标记'else'无效 - Invalid token 'else' in class, struct, or interface member declaration C#-类struct或接口成员声明中的无效令牌'' - C# - invalid token '' in class struct or interface member declaration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM