Suppose I have a class like
class Test {
public Test() {
Name = "Hello";
}
public string Name { get; set; }
}
I want a function which, when given an object and a string, returns the value of the property of the object whose name is the string. For example,
Test myTest = new Test();
string myName = f(myTest, "Name"); // myName == "Hello"
Is this possible? Does there exist such a function?