0
Je veux que mon résultat comme celui-ciComment puis-je récupérer une liste distincte dans Linq?
McLaren Cup
The Regis Brunch
21st Jan 2017
24st Jan 2017
26st Jan 2017
General Entry
General Parking
Picnic Parking
21st Jan 2017
24st Jan 2017
26st Jan 2017
Pour cela, je l'ai requête LINQ, mais me fais exception comme suit Informations complémentaires: L'opération « Distinct » ne peut pas être appliqué à la collecte ResultType de l'argument spécifié.
var Ticketdata = (from Tevent in context.TicketEventsMaster
where Tevent.IsActive == true && Tevent.IsVisible == true
select new
{
EventID = Tevent.TicketEventID,
eventName = Tevent.TicketEventName,
EventCategories = (from TEM in context.TicketCategoriesMaster
join TED in context.TicketEventDates on TEM.CategoryID equals TED.TCategoryID
where TED.IsActive == true && TED.IsVisible == true && TED.TEventID == Tevent.TicketEventID
//orderby TED.DisplayOrder
select new
{
CategoryID = TED.TCategoryID,
CategoryName = TEM.CategoryName,
EventDates = (from tDate in context.TicketEventDates
where
tDate.IsActive == true && tDate.IsVisible == true
&& tDate.TEventID == Tevent.TicketEventID
&& tDate.TCategoryID == TEM.CategoryID
orderby tDate.TEventDate
select new
{
DateID = TED.ID,
Dates = TED.TEventDate != null ? TED.TEventDate.ToString() : string.Empty,
Times = TED.TEventTime != null ? TED.TEventTime.ToString() : string.Empty,
}).ToList()
}).Distinct().ToList()
}).ToList();