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 :: c# split on multiple characters 
Csharp :: c# letters only 
Csharp :: unity spherecast 
Csharp :: unity 2d player move 
Csharp :: unity getcomponent not working on ui 
Csharp :: unity default cube mesh 
Csharp :: c# datagridview filter textbox 
Csharp :: how to make a car in unity 
Csharp :: how to get parent gameobject in unity 
Csharp :: dictionary c# iterate 
Csharp :: csharp 
Csharp :: untiy instanciate prefab 
Csharp :: how to say hello world in c# 
Csharp :: c# list to array 
Csharp :: Cursor Lock and Visible in Unity 
Csharp :: c# making a folder wpf 
Csharp :: c# unity detect any keyboard input but not mouse input 
Csharp :: unity c# log an error or warning 
Csharp :: simple player controller unity 
Csharp :: c# read file from directory 
Csharp :: replace index in string c# 
Csharp :: OnMousedown unity ui 
Csharp :: int to bool c# 
Csharp :: make http request c# 
Csharp :: unity how to set rigidbody velocity 
Csharp :: c# Get all class by namespace 
Csharp :: check if internet is connected with c# winforms 
Csharp :: debug.log 
Csharp :: how to work with ascii in c# 
Csharp :: .net core check if linux 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =