if(SomeCondition) Data = Data.GroupBy(g => g.Destination).Select(s => s.First()).ToList(); else Data = Data.GroupBy(g => g.DialCode).Select(s => s.First()).ToList(); // Is there a way I can define a Func<> or something to replace this ? Func< "What do I put here"> grouper = "What do I put here"; // so I can say Data = Data.GroupBy(grouper).Select(s => s.First()).ToList();