Created
November 10, 2009 23:33
-
-
Save anonymous/231389 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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