Created
September 16, 2011 14:02
-
-
Save ashic/1222186 to your computer and use it in GitHub Desktop.
ContainsKey on object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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