Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unique items in list c#

var uniqueItemsList = yourList.Distinct().ToList();
Comment

how to get unique list in c#

using(var dataModel = new DataModel())
{
  var classes = dataModel.Attributes.Where(a => a.Field == "Class").Select(a => a.Key).Distinct().ToList();
}
Comment

C# list of unique items

HashSet<T> uniqueList;
Comment

c# list with only unique items

If your requirements are to have no duplicates, you should be using a HashSet.
HashSet.Add will return false when the item already exists (if that even matters to you).
Comment

PREVIOUS NEXT
Code Example
Csharp :: dotween sequence 
Csharp :: how to get a length of a string in c# 
Csharp :: Get the Photon Player GameObject 
Csharp :: c# handle single quote inside string 
Csharp :: c# how to crete array 
Csharp :: unity onclick object 
Csharp :: unity rigid body variable 
Csharp :: add spaces in string 
Csharp :: cause bsod c# 
Csharp :: To CharArray 
Csharp :: select random from enum c# 
Csharp :: c# random number between 0 and 1 
Csharp :: c# online compiler 
Csharp :: how to make a 3d object do something when clicked on 
Csharp :: c# read double 
Csharp :: parametrizedthreadstart C# 
Csharp :: c# convert datetime to year & month 
Csharp :: element click intercepted exception in selenium C# 
Csharp :: finally c# code 
Csharp :: convert object to iqueryable in c# 
Csharp :: string to array c# 
Csharp :: c# how to append in array 
Csharp :: c# round to closest multiple 
Csharp :: finding keys in the registry 
Csharp :: player input manager join manually 
Csharp :: jagged array to 2d array c# 
Csharp :: c# access substring 
Csharp :: C# Linq item index 
Csharp :: how to write text in specific position in c# 
Csharp :: c# group array based on first character 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =