Create a gist now

Instantly share code, notes, and snippets.

@kevingosse /GetFields.cs Secret
Created Mar 26, 2017

What would you like to do?
static void Main(string[] args)
{
void DisplayAttributes()
{
var fields = new SomeAttribute()
.GetType()
.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic));
foreach (var field in fields
{
Console.WriteLine(field.Name);
}
}
typeof(SomeClass).GetCustomAttributes(false);
DisplayAttributes();
DisplayAttributes();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment