Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var properties = TypeDescriptor.GetProperties(typeof(ISuperHero))
.OfType<PropertyDescriptor>()
.Concat(typeof(ISuperHero).GetInterfaces().SelectMany(x => TypeDescriptor.GetProperties(x).OfType<PropertyDescriptor>()));
foreach (PropertyDescriptor property in properties)
{
Console.WriteLine(property.Name);
}
// reflection
var reflectedProperties = typeof(ISuperHero).GetProperties()
.Concat(typeof(ISuperHero).GetInterfaces().SelectMany(x => x.GetProperties()));
foreach (var property in reflectedProperties)
{
Console.WriteLine(property.Name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.