@value works equivalently to value keyword #5372
-
Not sure if this is a bug or issue to be reported or fixed. But it's a little annoying when I try to set a variable name to Basically this: private int @value;
public int Value { get => @value; set => value = @value; } causes issues. Code is a bit more complicated than above though, but it's the simplest example I could come up with. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Per the spec,
This means your setter basically behaves as if it was a method with the signature private int value;
public int Value { get => value; set => this.value = value; } |
Beta Was this translation helpful? Give feedback.
Per the spec,
value
is not technically a keyword:This means your setter basically behaves as if it was a method with the signature
public void SetValue(int value)
and you can't use@value
to refer to the field in such a method either. You can usethis.value
, though: