Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to use distinct in linq query in c#

var distValues = objList.Select(o=>o.typeId).Distinct().ToList();
Comment

linq distinct

var uniquePeople = from p in people
                   group p by new {p.ID} //or group by new {p.ID, p.Name, p.Whatever}
                   into mygroup
                   select mygroup.FirstOrDefault();
Comment

select distinct linq mvc

public static IQueryable<ProdType> GetDistinctProdType(
    this IQueryable<ProdInfo> query,
    int categoryId)
{
    return (from p in query
            where p.CatID == categoryId
            select p.Type).Distinct();
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: plays ervices unity sigin 
Csharp :: how to pass object as test case in nunit c# 
Csharp :: telerik mvc grid required field 
Csharp :: c# odd or even 
Csharp :: unity blender shadow messed up 
Csharp :: character stay in ground unity 3d 
Csharp :: asp.net razor get list without refresh 
Csharp :: c# open config file by path 
Csharp :: C# remain space 
Csharp :: c# show hidden window wpf 
Csharp :: unity save slots 
Csharp :: c# class responsible for creating instances 
Csharp :: how to create vg in aix 
Csharp :: C# parallel for loop specify cores 
Csharp :: windows forms link listbox to array 
Csharp :: c# changimg to one decimal place 
Csharp :: small basic input 
Csharp :: BOTON PARA CAMBIAR DE VIEW ASP.NET 
Csharp :: 2d movement unity 
Csharp :: Read from textfile and fill in textbox 
Csharp :: conevrt list to pipe separated string c# 
Csharp :: remove tag anchor and inside tag from html raw text c# 
Csharp :: how can datetimepicker accept hour as well 
Csharp :: c# null coalescing operator 
Csharp :: c# capitalize first letter of each word in a string 
Csharp :: unity c# rate game 
Csharp :: get index of item unity 
Csharp :: get selected rows gridcontrol devexpress 
Csharp :: C# a program to reverse each word in the given string. 
Csharp :: git change remote origin 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =