简体   繁体   中英

Invalid token 'token' in class, struct, or interface member declaration

I'm trying to create the following 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. 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.

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

base is a special C# keyword.

Anyways, public properties should begin with uppercase letter:

public decimal Base { get; set; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM