I need to cast to a specific Type at Runtime.
How it works, and looks like – now:
Customer test = (Customer)entityBase.GetType().GetProperty("Customer").GetValue(entityBase, null);
The Customer as String, where I need for GetProperty(), isn’t written like that directly, it comes from a Variable, that changes always. I just wrote “Customer”, for comprehension purposes.
What I want now is the same, but without telling, that its a Customer or any Type.
Placeholder test = (Placeholder)entityBase.GetType().GetProperty("That Changes, thats fine").GetValue(entityBase, null);
Cause it could also be something like that:
Order test = (Order)entityBase.GetType().GetProperty("That Changes, thats fine").GetValue(entityBase, null);
I tried things like businnesObject = Activator.CreateInstance(type);
Hope someone has a small solution for this
CustomerandOrderboth inherit fromSystem.Object, so you can just use