I often need to enlarge an object with a property, for example. So far (tired of this), and this is also ugly) I did it like this:
var someListOfObjects = ...;
var objectsWithMyProperty = from o in someListOfObjects
select new
{
o.Name,
o.Address,
SomeNewProperty = value
};
Is there any reasonable way to do this? I have done this before:
var objectsWithMyProperty = from o in someListOfObjects
select new
{
OldObject = o,
SomeNewProperty = value
};
I think this can be done with some reflection, but I believe that there is a faster approach that does something equivalent to the first cumbersome approach.
Thanks Lasse
source
share