Loop DynamicObject properties

I believe you’d be interested in the ExpandoObject class. The DynamicObject class is just a base where you’re meant to provide all the logic. It explicitly implements the IDictionary<string, object> interface so you can access it properties or add new ones that way. // declare the ExpandoObject dynamic expObj = new ExpandoObject(); expObj.Name = “MyName”; … Read more

Is there a way to convert a dynamic or anonymous object to a strongly typed, declared object?

You could serialize to an intermediate format, just to deserialize it right thereafter. It’s not the most elegant or efficient way, but it might get your job done: Suppose this is your class: // Typed definition class C { public string A; public int B; } And this is your anonymous instance: // Untyped instance … Read more

dynamic does not contain a definition for a property from a project reference

Jahamal’s answer doesn’t say why you get the error. The reason is that the anonymous class is internal to the assembly. Keyword dynamic doesn’t allow you to bypass member visibility. The solution is to replace the anonymous class with named public class. Here’s another good example explaining the reason and another possible solution. The reason … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)