The problem is: I have a list of objects, with some containing the same PlanId property value. I want to only grab the first occurrence of those and ignore the next object with that PlanId. The root problem is a View in the database, but it's tied in everywhere and I don't know if changing it will break a ton of stuff nearing a deadline, so I'm tossing in a hack for now.
So, if I have a list of PlanObjects like such.
- Plan1.PlanId = 1
- Plan2.PlanId = 1
- Plan3.PlanId = 2
- Plan4.PlanId = 3
- Plan5.PlanId = 4
- Plan6.PlanId = 4
I want to take a sub-list from that with LINQ (italics mean an item is not included)
- Plan1.PlanId = 1
- Plan2.PlanId = 1
- Plan3.PlanId = 2
- Plan4.PlanId = 3
- Plan5.PlanId = 4
- Plan6.PlanId = 4
For my needs, it doesn't matter which one is taken first. The Id is used to update a datbase record.
If I didn't explain that well enough, let me know and I'll edit the question. I think it makes sense though.