score:0
... = this.distinct().tolist()
score:1
var distinctcodes= this.distinct().tolist();
this.clear();
var c1 = this.count(); // 0
var c2 = distinctcodes.count(); // eg. 100
score:1
var distinctcodes = this.tolist().distinct();
Source: stackoverflow.com
Related Query
- How to break link between source collection and LINQ result
- How to assign LINQ Query result to Custom Collection and convert List<T> to T[]
- How to sort by a specific key and then get the first result in the sorted collection into a group in LINQ
- How to execute a linq query for each item in a list , use it in the where clause and return a collection from the result of each query?
- How to add an item in a collection using Linq and C#
- How can I iterate over a collection and change values with LINQ extension methods?
- Using C# , LINQ how to pick items between markers again and again?
- How can I group by the difference between rows in a column with linq and c#?
- LINQ Union between two tables with the same fields and then returned in a collection
- How can I share Linq to Entities datacontracts between WCF and Silverlight
- Pros & cons between LINQ and traditional collection based approaches
- How can I use Linq to join between objects and entities?
- LINQ Query How to select Max value between start and end index and the index of the max value
- c# Different Result between Linq and SQL
- How to easly convert linq result to Business Object Collection <T>
- How can I use LINQ to filter and sort rows from one collection to another?
- How can I get the top three players and their high scores from a collection using linq and lambdas
- Differences between LINQ where and where method on a collection
- LINQ Query How to select Max value between start and end index
- How to Join in LINQ using Lambda expressions and get the result in DTO?
- How to convert LINQ query result to list and return generic List?
- LINQ how to return last date and difference between first and last count
- Linq - How to take the result for a query in Linq and add it to an Array
- How do I use LINQ to filter AND manipulate results based on values intersecting between a child and comparer?
- How do I write Joins between multiple tables with Linq and ASP.Net Forms
- How do I create a linq statement to take a list of items and break them into groups of 50 each
- How does Linq projection work between Extention Method and query expression
- How to join two arrays in a LINQ query and use the result further in the query?
- How do I group items from a collection using LINQ and return the shaped data according the collection type
- How to fill properties of objects using LINQ and return collection
More Query from same tag
- Remove contents of custom properties in Word 2010 with Open XML SDK 2.0 or Linq
- selecting max values in relational tables with linq
- How to get enumerable or collection of values from WhereSelectListIterator
- Deleting bulk objects in DataContext
- Join 2 table and just display the active column
- LINQ to SQL where clause verifying string contains list element
- LINQ using Contain with Include
- add nested group by query Linq to property model class ASP.NET
- How to convert C# Linq to query in SQL Server?
- Linq to Xml query to child nodes
- LINQ with group by and selecting columns from other table: "not defined in this context" error
- ML.NET How can I get my IDataView from a linq query?
- return 0 for items count in linq statement
- Linq to SQL "not like" operator
- Looking for a data structure that is optimized for finding the next closest element
- What would be the linq for this SQL Group Join
- ASP.net Getting Max Date of database Date column How to avoid Null in Date Column C# My code Attached
- How to handle nulls in LINQ when using Min or Max?
- Search DataTable using LINQ
- Implementation options of summing, averaging, concatenating, etc items in an IEnumerable
- Datagridview to array missing one row
- query base object based on a non related entity list using entity framework
- How to get alternate numbers using Enumerable.Range?
- SQL Server version of Oracle's CONNECT BY in LINQ to show hierachy
- C# Want to remove elements from IEnumerable<Dictionary<string, object>> based on condition using lambda expression?
- Fill DTO from two distinct objects
- C# Random Pair generation
- Optimization build dictionary for list of list
- Technique for dynamically adding a join to a linq query?
- LINQ to XML: filter a query using XElement.Attributes() collection with both XName and Value