Hi All
How can I access to the attribute of a field by an object to whom this field references to.
I have defined:
Now I want to access to 'MyAttrib' within class Bb in the following way:
Is there any way to do this by reflection.
Or how can the attributes assigned to the object-instances of Bb instead of assigning them to the fields?
Thank you
Tom
How can I access to the attribute of a field by an object to whom this field references to.
I have defined:
Code:
class A { [MyAttrib(Name="TestA";)] private Bb testing1 = new Bb(); [MyAttrib(Name="TestB";)] private Bb testing2 = new Bb(); }
Code:
class Bb { {private fields} public string GetName() { return (GetMyAttrib.Name) //-> return "TestA" o "TestB", depending on the field, which references to this object-instance } }
Or how can the attributes assigned to the object-instances of Bb instead of assigning them to the fields?
Thank you
Tom