System.Dynamic.ExpandoObject' does not contain a definition for
'PropertyName' when the property exsists
I am using some ExpandoObject dynamics in a MVC application of mine and I
am running into the above error. It only is seeming to happen with one or
two properties but it is consistent. I will get the run-time error stating
that no such property exists and then, when looking deeper and expanding
the dynamic view of the the object in the VS debugger the property exists
on the object and has a value.
Has anyone experienced this before and if so do you have any insight?
I have tried casting the object to see if that would work but I got the
same error. The code that I used to cast it follows as an example of some
of the things I have already tried mostly just to see if I could get at
the property at all.
var cur = new ExpandoObject() as IDictionary<string, object>;
cur = inputDynamic;
string property = (string)cur["propertyName"];
No comments:
Post a Comment