public void Removeduplicateobject(List <ObjectSectionManager> list) { for (int i = 1; i < list.Count; i++) { for (int j = i - 1; j < i; j++) { ObjectSectionManager val1 = list[i]; ObjectSectionManager val2 = list[j]; if (val1.Name.Equals(val2.Name)) { list.RemoveAt(j); i--; } } } }
public void GetDataSection(Document doc) { var col2 = new FilteredElementCollector(doc).WhereElementIsNotElementType().OfClass(typeof(View)).Cast <View>().ToList(); col2.OrderBy(x => x.Name).ToList(); foreach (var item in ListView) { foreach (var index in col2) { if (item.Equals(index.Name)) { ObjectSectionManager objectSection = new ObjectSectionManager(item, index.Id); ListObjectSections.Add(objectSection); } } } ListObjectSections.OrderByDescending(x => x.Name); }