dnSpy - How to fix BackingField in getter and setter methods
You may meet BackingFields in dnSpy
but you don’t know what it is and how to fix?
BackingFields are generated by
compiler because they use auto Properties like this
public string Type { get; set; }
I think because some devs are lazy...
I don’t know lol
This is how it looks like when editing
getter. BackingField is red
And when you compile, you get the
following errors
But it’s easy to fix, edit getter add
a new field and return it with your field and compile. In this case, I add public
bool isGlobal for IsGlobal
Edit setter, edit to (Type) = value;
and compile
Done!
Now you can mod it like adding if-else statement for mod menu
Now you can mod it like adding if-else statement for mod menu