Bookmark and Share

Check if a property exists on a dynamic property with the ExpandoObject in dotnet

A dynamic object or ExpandoObject implements a dictionary so it's very easy to see if a property exists:

        private static bool propertyExists(dynamic Dynamique, string Property)
        {
            IDictionary properties = (IDictionary)Dynamique;
            return properties.ContainsKey(Property);
        }