I am creating an anonymous type and I have conflicting field names.
The following code is failing because i.Name and i.Target.Name both have a property with the same name; "Name".
How do I get around this ? Here is the code:
i => new
{
i.Name,
i.Target.Name,
i.EndDate,
i.LastUpdated
};
Name the anonymous fields, as such:
new {Name = i.Name, targetName = i.Target.Name, ... };
i => new
{
i.Name,
TargetName = i.Target.Name,
i.EndDate,
i.LastUpdated
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With