mardi 16 février 2016

Get a container class instance from a FieldInfo

I am working with C# reflection here: I have a FieldInfo of a property and I would like to get the instance of the class it belong (so I can reach the content of another property):

for exemple take this class:

class MyClass
{
   public int A { get; set; }
   public int B { get; set; }
}

in some part of the code I have

void Function(FieldInfo fieldInfoOfA)
{
  // here I need to find the value of B
}

Is this possible ?





Aucun commentaire:

Enregistrer un commentaire