c# - Get concrete property that implements type -
given following classes
public foo { public foo() { this.bar = new bar(); } public ibar bar{ get; set;} } public bar : ibar { // implemented properties }
how can concrete implementation of property bar on foo using reflection?
instance.gettype().getproperty("bar").propertytype
yields interface only.
if trying type implements ibar should it's value , take type:
var type = instance.gettype().getproperty("bar").getvalue(instance,null).gettype()
Comments
Post a Comment