public void RemoveDuplicatesByName(){ List<Posting> postings = GetAllPostings(); postings.Sort(); for (int i = 1; i < postings.Count; i++) { if (postings[i].Name == postings[i - 1].Name) { postings.RemoveAt(i); i--; } }}public List<Posting> GetAllPostings(){ List<Posting> postings = new List<Posting>(); Posting posting; posting = new Posting("post1", "2005-5-11"); postings.Add(posting); posting = new Posting("post1", "2005-5-11"); postings.Add(posting); posting = new Posting("post2", "2005-6-11"); postings.Add(posting); posting = new Posting("post2", "2005-5-11"); postings.Add(posting); posting = new Posting("post3", "2005-8-11"); postings.Add(posting); posting = new Posting("post2", "2005-7-11"); postings.Add(posting); posting = new Posting("post1", "2005-5-12"); postings.Add(posting); posting = new Posting("post2", "2005-8-11"); postings.Add(posting); return postings;}public class Posting : IComparable<Posting>{ private string name; private string lastModifiedDate; public Posting(string name, string lastModifiedDate) { this.name = name; this.lastModifiedDate = lastModifiedDate; } public string Name { get { return name; } set { name = value; } } public string LastModifiedDate { get { return lastModifiedDate; } set { lastModifiedDate = value; } } public int CompareTo(Posting other) { return (String.Compare(this.Name, other.Name)); }}