I have a Type that implements an interface with a static property:
public class MyClass : IMyClass
{
public static string SomeInfo = "Lorem Ipsum";
...
}
I want to get the value of SomeInfo
without instantiating the class. Seems like I should be able to do this since the property is public static
.
I can get the property like this:
var myClass = Type.GetType("MyNamespace.MyClass");
var someInfoProperty = myClass.GetProperty("SomeInfo", BindingFlags.Public | BindingFlags.Static);
However, I cannot figure out how to the value of someInfoProperty
. The property method GetValue() requires an object (instance of the class).
Any idea how I can do this, or is it even possible?
Thanks.