1

I created a property:

public string fixed { get; set; }

It appears "fixed" has an inbuilt definition. So it doesnt allow me to, says invalid token. But I need to create it with the same name. Is there a way, please help.

Rustin Cohle
  • 161
  • 1
  • 1
  • 12

1 Answers1

5

You can try doing the following:

public string @fixed { get; set; }

As the documentation says, you can use a keyword as a identifier in your code only with @.

Best of luck!

EDIT

If you want property names mapping, (and I assume you serialize them in some way), you can also

    [JsonProperty(PropertyName = "fixed")]
    public string Fixed { get;  set; }

if you use Newtonsoft Json Converter.

(It is also a much cleaner way to handle things)

radu-matei
  • 3,469
  • 1
  • 29
  • 47