You need to know the closed type of a generic class before you can access its generic members. The use of TestGeneric gives you the open type definition, which cannot be invoked without specifying the generic arguments The simplest way for you to get the value of the property is to reflect on the closed type in use directly: public static void Main() { object myObject = new TestGeneric("test"); // or from another source var type = myObject.GetType(); if (IsSubclassOfRawGeneric(typeof(TestGeneric), type)) { var dataProperty = type. GetProperty("Data"); object data = dataProperty.
GetValue(myObject, new object { }); } }.
You need to know the closed type of a generic class before you can access its generic members. The use of TestGeneric gives you the open type definition, which cannot be invoked without specifying the generic arguments. The simplest way for you to get the value of the property is to reflect on the closed type in use directly: public static void Main() { object myObject = new TestGeneric("test"); // or from another source var type = myObject.GetType(); if (IsSubclassOfRawGeneric(typeof(TestGeneric), type)) { var dataProperty = type.
GetProperty("Data"); object data = dataProperty. GetValue(myObject, new object { }); } }.
You've been faster ;) Thx anyway. – Martin Booka Weser Jan 4 at 10:50.
Ahh, sorry for that. It was a simple mistake, the generic version works, of course it must read var dataProperty = myObject.GetType(). GetProperty("Data"); object data = dataProperty.
GetValue(myObject, new object { }).
That's the perfect usage example which makes the code A LOT more readable: dynamic dynObject = myObject; object data = dynObject.Data.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.