I have an application that is built on top of dynamic and reflection types.
dynamic obj = null;
obj = My_Assembly.CreateInstance("full.namespace.class");
obj.DateCreated = DateTime.Now;
obj.DateModified = DateTime.Now;
obj.DateStarted = DateTime.Now;
.....
myservice.Add(ref obj, false);
Runtime raises an exception that The best overloaded method match for ... has some invalid arguments
I did a trick to see whats wrong...
var objd = (full.namespace.class)obj;
myservice.Add(ref obj, false);
and it works fine. To see what's difference I ran a quick match in immediate window
? obj == objd;
true
and the result was true which means both are identical.
Can anyone explain me whats wrong with it?
Aucun commentaire:
Enregistrer un commentaire