Skip to content

Instantly share code, notes, and snippets.

@afucher
Created January 19, 2021 23:05
Show Gist options
  • Save afucher/b6114bc4dcf9b162f0ade473279ed10e to your computer and use it in GitHub Desktop.
Save afucher/b6114bc4dcf9b162f0ade473279ed10e to your computer and use it in GitHub Desktop.
[dotnet] Imprime propriedades e valores de um objeto
foreach(PropertyDescriptor descriptor in TypeDescriptor.GetProperties(obj))
{
string name=descriptor.Name;
object value=descriptor.GetValue(obj);
Console.WriteLine("{0}={1}",name,value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment