Skip to content

Instantly share code, notes, and snippets.

@ashic
Created September 16, 2011 14:06
Show Gist options
  • Save ashic/1222196 to your computer and use it in GitHub Desktop.
Save ashic/1222196 to your computer and use it in GitHub Desktop.
public static IDictionary<string, object> ToDictionary(this object target)
{
return target.GetType().GetProperties().ToDictionary(x => x.Name, y => y.GetValue(target, new object[] { }));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment