Ok. So I have a list of values, and I'd like to do something like the following:
MyObjectValues
.Select(currentItems=>new MyType()
{
Parameter1 = currentItems.Value1,
Parameter2 = currentItems.Value2
});
So here's the problem. I need the above example to work with named constructors, such as:
MyObjectValues
.Select(currentItems=>MyType.GetNewInstance()
{
Parameter1 = currentItems.Value1,
Parameter2 = currentItems.Value2
});
Is there any way I can do that? Basically, I have a static method I need to call to get the object instance back, and I'd like to initialize it as above.
EDIT: I don't have an easy way to modify the interface of MyType at present, so adding new function calls (while probably the 'best' approach) isn't very practical at the moment.