Skip to content

Instantly share code, notes, and snippets.

@ashic
Created September 16, 2011 14:02
Show Gist options
  • Save ashic/1222186 to your computer and use it in GitHub Desktop.
Save ashic/1222186 to your computer and use it in GitHub Desktop.
ContainsKey on object
namespace System
{
public static class ObjectExtensions
{
public static bool ContainsKey(this object target, string key)
{
return target.GetType().GetProperties().Any(x => x.Name == key);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment