Skip to content

Instantly share code, notes, and snippets.

@ShvedAction
Last active February 14, 2024 23:55
Show Gist options
  • Save ShvedAction/b78114b40cf3a6bf228ce1c7e45a4a6a to your computer and use it in GitHub Desktop.
Save ShvedAction/b78114b40cf3a6bf228ce1c7e45a4a6a to your computer and use it in GitHub Desktop.
C# Reflection: How to get access to property of anonymous objects.
object getProp(object source, string name)
{
var type = source.GetType();
var prop = type.GetProperty(name);
return prop.GetValue(source);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment