Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidisnotnull/e456a45935fe8c93fb783cd163fc41c6 to your computer and use it in GitHub Desktop.
Save davidisnotnull/e456a45935fe8c93fb783cd163fc41c6 to your computer and use it in GitHub Desktop.
Using C# Interactive window to get all properties of an object
> #r "C:/MyApp/bin/Debug/Foo.dll"
> using MyApp;
> var personType = typeof(Person);
> var personProperties = personType.GetProperties();
> foreach(var personProperty in personProperty) { Console.WriteLine($"{nameof(Person)}.{personProperty.Name}"); }

This will return a list of all of the properties to the Console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment