jeudi 7 mai 2020

Get Field(s) behind a property

Is it possible to get the field(s) which is used for a property's get and set through Reflection?

For example, if I have this:

private int numb;

public int Number
{
 get => numb;
 set => numb = value;
}

Is it possible to know which backing field Number is using for its set property?

In this case, returning numb.





Aucun commentaire:

Enregistrer un commentaire