Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save liulixiang1988/9930841 to your computer and use it in GitHub Desktop.
Save liulixiang1988/9930841 to your computer and use it in GitHub Desktop.
//http://stackoverflow.com/questions/852181/c-printing-all-properties-of-an-object
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