Skip to content

Instantly share code, notes, and snippets.

@kevingosse
Created March 26, 2017 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevingosse/28d183ffa6c731dcf61d8f96eca3547c to your computer and use it in GitHub Desktop.
Save kevingosse/28d183ffa6c731dcf61d8f96eca3547c to your computer and use it in GitHub Desktop.
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