using System.Collections.Generic;
public string ProductCode {get;set;}
public string UserImportId {get;set;}
public string NameCustomer {get;set;}
public static void Main() {
string[] names = { "Burke", "Laptop", "Computer",
"Mobile", "Ahemed", "Sania",
"Kungada", "David","United","Sinshia" };
var query = from s in names
foreach (string item in query)
var products = new List<Product>
new Product {ProductCode = "FICO", UserImportId = "111", NameCustomer = "NGUYEEN KIEM" },
new Product {ProductCode = "FICO", UserImportId = "111", NameCustomer = "Bùi Minh Huy" },
new Product {ProductCode = "XXX", UserImportId = "111", NameCustomer = "DINH GIO" },
new Product {ProductCode = "XXX", UserImportId = "111", NameCustomer = "TRONG HOANG" },
new Product {ProductCode = "ZZZ", UserImportId = "111", NameCustomer = "TAM MAO" },
var groupBy = products.GroupBy(g => new {g.ProductCode, g.UserImportId}).First().Select(x => x);
foreach (var item in groupBy)
Console.WriteLine(item.NameCustomer);