Remove Duplicates From Strongly Typed Collections With Extension Methods
Just a quick note to myself in case I begin the horrendous search for this again, the best / most performant way I have found to remove duplicates follows this structure:
- public static class Extensions
- {
- public static IEnumerable<T> RemoveDuplicates<T>(this IEnumerable<T> source)
- {
- return RemoveDuplicates(source, (t1, t2) => t1.Equals(t2));
- }
- public static IEnumerable<T> RemoveDuplicates<T>(this IEnumerable<T> source, Func<T, T, bool> equater)
- {
- var result = new List<T>();
- foreach (var item in source.Where(item => result.All(t => !equater(item, t))))
- {
- result.Add(item);
- }
- return result;
- }
- }
Articles & Research
SharePoint Security
SharePoint Development
SharePoint Architecture
Claims Authentication
Forefront For SharePoint
AIS / Dynamics GP
Team Foundation Server
Pex And Moles
ISA/TMG/IAG/UAG
DPM
Cardspace
Research Methodology
Rural ICT Development
Numerical Analysis
Multi-Level Research
Knowledge Management
Personal/Off-Topic