using System.Diagnostics;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Threading.Tasks;
public static void Main()
var setting = new Faker<EzEmployee>()
.RuleFor(p => p.RowId, f => Guid.NewGuid().ToString())
.RuleFor(p => p.EmailAddress, (f, p) => f.Internet.Email())
.RuleFor(p => p.Status, f => f.PickRandom<EzStatus>().ToString());
var emps = setting.Generate(15000);
Console.WriteLine("Total Distinct Email Count:" + emps.Select(x => x.EmailAddress).Distinct().Count());
Console.WriteLine(String.Empty);
public static void GoForeachList(List<EzEmployee> data)
var watch = new Stopwatch();
data.OrderBy(c => c.EmailAddress).ThenBy(n => n.Status);
data = data.Where(d=>Enum.IsDefined(typeof(EzStatus), d.Status)).GroupBy(p => p.EmailAddress).Select(g => g.First()).ToList();
Console.WriteLine("========= Foreach List =========");
Console.WriteLine("Exec total Milliseconds:" + watch.ElapsedMilliseconds);
Console.WriteLine("Exec total count:" + data.Count());
public int Id { get; set; }
public string RowId { get; set; }
public string EmailAddress { get; set; }
public string Status { get; set; }