c# - Read properties of derived as well as base class -


i have 2 classes

class 1

public class baseclass {    public string prop1{get;set;}    public string prop2{get;set;}    public string prop3{get;set;} } 

class 2

public class derived:baseclass {     public string prop4{get;set;} } 

now when try read properties following code, obvious returns derived class's properties

propertydescriptorcollection properties = typedescriptor.getproperties(typeof(derived)); 

is there way can read properties of derived baseclass

why not use reflection?

  propertyinfo[] properties = typeof(derived).getproperties(bindingflags.public | bindingflags.instance);    console.write(string.join(envrironment.newline, properties.select(p => p.name))); 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -