I want to read out the properties of a field by the instance, which is referenced by the corresponding field. I want to read out the attributes.
In a class I wrote the following:
Expand|Select|Wrap|Line Numbers
- class A
- {
- [MyAttrib(Name="TestA";)]
- private Bb testing1 = new Bb();
- [MyAttrib(Name="TestB";)]
- private Bb testing2 = new Bb();
- }
Expand|Select|Wrap|Line Numbers
- class Bb
- {
- {private fields}
- public string GetName()
- {
- return (GetMyAttrib.Name) //-> this should return "TestA" or "TestB", dependent of the corresponding instance
- }
- }
How can I do this?
Or is it possible to inherit the attributes of the fields in A to the corresponding object instance of Bb, so that the attributes are directly binded to the corresponding object?
Thank you
Tom