Mario Escudero
Mario Escudero

Reputation: 13

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

Upvotes: 0

Views: 126

Answers (2)

Kroepniek
Kroepniek

Reputation: 395

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; }

Upvotes: 3

theemee
theemee

Reputation: 834

base is a special C# keyword.

Anyways, public properties should begin with uppercase letter:

public decimal Base { get; set; }

Upvotes: 0

Related Questions