Skip to content

Instantly share code, notes, and snippets.

@sparkertime
Created February 27, 2010 17:37
Show Gist options
  • Save sparkertime/316837 to your computer and use it in GitHub Desktop.
Save sparkertime/316837 to your computer and use it in GitHub Desktop.
internal static class Translator
{
public static Dictionary<string, string> Translate(object values)
{
var result = new Dictionary<string, string>();
if (values != null)
{
foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(values))
{
var value = descriptor.GetValue(values).ToString();
result.Add(descriptor.Name, value);
}
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment