Resmi P

Resmi P

  • NA
  • 1
  • 0

How to get only the protected property in the baseclass using GetProperties(BindingFlags).....

May 30 2006 8:28 AM
Hi

Iam having a baseclass with 1 public property & 1 protected property. In the derived class I 've 2 public properties.Now using GetProperties(BindingFlags) ,I want the protected property of the base class & not the public property & the also the public properties of the derived class.So i want total 3 properties.I tried .But Iam getting either 4 properties(2Base+2 deri) or 2properties(2 der)

DerivedClass derClass=new DerivedClass();

Type type=derClass.GetType();

PropertyInfo[] ppties=type.GetProperties(BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic) ;

IEnumerator iEnum=ppties.GetEnumerator();

while(iEnum.MoveNext())

{

PropertyInfo property = (PropertyInfo)iEnum.Current;

}

Can anyone solve this problem????????