User

User

  • NA
  • 2
  • 0

Linq help

Feb 22 2010 11:19 AM

Class Order
{
     List<Trigger> TriggerCollection;
}

Class Trigger
{
   enum TriggerType;
   Guid ConfigTriggerID;
}

Data eg.

Order1
   TriggerCollection       TriggerType       ConfigTriggerID
                                        1                      100
                                        2                      100
                                        3                      200
                                        1                      400
                                        2                      400
                                        3                      500

I need to get the count of ConfigTriggerID that are distinct among the triggertypes. if you group this by Trigger type,
Group By data,

                                 TriggerType       ConfigTriggerID
                                        1                      100
                                        1                      400
                                        2                      100
                                        2                      400
                                        3                      200
                                        3                      500

TriggerTypes 1 and 2 have the same ConfigTriggerID. So count of ConfigTriggerID is 1 so far. Only TriggerType 3 has a different ConfigTriggerID. So the total distinct count is 2.
How can this be done using Linq?

Answers (1)