Find Distinct elements from a List C# -
I have a class named I have a list of products, along with I want to get a different product from the list at I if list I would like any of the above product. I want to get it without looping like this: Any suggestions? using product
Public category product {get public string name { Set; } Public int ProductId {get; Set; }}
name , but different
ProductId .
product.Name
var fullproductList = {Name: Product, Product ID: 1}, {Name: Product, Product ID: 2}, {Name: Product, Product ID: 3};
list & gt; Products & gt; Specific Products = New List & lt; Products & gt; (); Var distictproductName = fullSubjectList.Select (x => x.Name). Undoubtedly (). ToList (); Foreign objects (different items distictproductName) {different products.ed (fullproduct list. Where (x => x.Name == item). First and default ()); }
separate with lambda:
Full Subject List. Distinction (x = & gt; x.Name). Ollist ();
Comments
Post a Comment