E
Eric Chappuis
How can I use reflexion to get an object by its local name.
I found the Type.GetMember(string name) which return a MemberInfo, but I
can't jump from MemberInfo to the member itself.
I would like to fill the function getByName :
class A {
B b1 = new B();
B b2 = new B();
public getByName (string s) {
// how to retrieve object b1 if (s == "b1") or b2 if (s == "b2")
// or to retrive an object by its name
}
}
class B { //... }
I found the Type.GetMember(string name) which return a MemberInfo, but I
can't jump from MemberInfo to the member itself.
I would like to fill the function getByName :
class A {
B b1 = new B();
B b2 = new B();
public getByName (string s) {
// how to retrieve object b1 if (s == "b1") or b2 if (s == "b2")
// or to retrive an object by its name
}
}
class B { //... }