Is there a way to check if an Expando object contains a property before interacting with it. For example, If i were to say var test = Expando.Something and Something didn't exist, it will throw an exception. How do i check to see if "Something" exists in the expando object before I query it?
Expando objects are just an abstraction. The class inherits from IDictionary<string, object>. This class supports the ContainsKey method and this will do what you need it to do. So if you cast the expando object to a dictionary first, you can use the contains key method to check if a key exists.Use the following if statement to check if a property exists in an expando object.