public class ReflectionBase
{
public String ParentProperty1 { get; set; }
public String ParentProperty2 { get; set; }
}
public class Reflection : ReflectionBase
{
public String ChildProperty1 { get; set; }
public Reflection()
{
var property = this.GetType().GetProperties();
}
}
Result:
ParentProperty1
ParentProperty2
ChildProperty1
I Need:
ChildProperty1
when i call GetProperties() it gave me all the current class property and the base class also but i just need the current class properties.
Any Help Please…
Use
BindingFlags.DeclaredOnlyto ignore inherited members: