I have an array of objects with the property of ProductId. I would like to use a lambda expression to select all the distinct values of ProductId that are within my object array products.
Here I get the products
var products = Database.SqlQuery<StructuredProduct>("query").ToArray();
And I can group by distinct values of ProductId, but it still returns an array of objects, rather than an array of ProductIds
var productIds= products.GroupBy(p => p.ProductId).Select(group => group.First()).ToArray();
Any idea on how to use a Lambda Expression on the products array to get all distinct values of ProductIds?