views:

12

answers:

0

Scenario is very simple somewhere in the code I have this

dynamic myVariable = GetDataThatLooksVerySimilarButNotTheSame();

 //how to do this?
 if (myVariable.MyProperty.Exists)   
 //Do stuff

So basically the question is how to check (avoiding exceptions) that a certain property is available in my dynamic variable. I could do GetType() but I d rather avoid that, I dont actually want to know the type of the object I want to know if a property (or method if that makes life easier) is available Any pointers?

Cheers