linq to find out whether primary phone is included
Posted on 2011-09-20
supposed i have a list of objects (MyObject), and they each contain a phone number, phone type (work, home, etc), and IsPrimary. i need to find out that if a phone number(s) is given for a particular type, one of them needs to be primary (IsPrimary=1). however, if no phone number for a type is given, it's ok. can i do this using LINQ, or would a dictionary be a better way to go? thanks.