|
by Paulo Morgado via Paulo Morgado : C# on 8/16/2010 12:55:31 AM
After my post about dumping objects using expression trees, I’ve been asked if the same could be done for hydrating objects. Sure it can, but it might not be that easy. What we are looking for is a way to set properties on objects of an unknown type. For that, we need to generate methods to set each property of the objects. Such methods would look like this expression: Expression<Action<object, object>> expression = (o, v) => ((SomeType)o).Property1 = (PropertyType)v;
Unfor
... [ read more ]
|
|