The post Distinct Method in LINQ MeThods in Entity Framework Core appeared first on OctopusCodes.
]]>using EntityFrameworkCore_ConsoleApp.Models;
namespace EntityFrameworkCore_ConsoleApp
{
public class Program
{
static void Main(string[] args)
{
using (var databaseContext = new DatabaseContext())
{
var categoryIds = databaseContext.Products.Select(product => product.CategoryId).Distinct().ToList();
categoryIds.ForEach(categoryId =>
{
Console.WriteLine("Category Id: " + categoryId);
Console.WriteLine("---------------------");
});
}
}
}
}
Category Id: 1
---------------------
Category Id: 2
---------------------
Category Id: 3
---------------------
The post Distinct Method in LINQ MeThods in Entity Framework Core appeared first on OctopusCodes.
]]>