/// <summary> /// Sort method /// </summary> /// <param name="sortDirection"> /// Pass in "Asc" for ascending or "Desc" for descending /// </param> public void Sort(string sortDirection) { if (sortDirection == null) { throw new ArgumentNullException("You must pass in \"Asc\" for ascending or \"Desc\" for descending"); } else if (!sortDirection.Equals("Asc") && !sortDirection.Equals("Desc")) { throw new ArgumentException("You must pass in \"Asc\" for ascending or \"Desc\" for descending"); } if (sortDirection.Equals("Asc")) { InnerList.Sort(); } else if (sortDirection.Equals("Desc")) { IComparer myComparer = new CollectionReverseSort(); InnerList.Sort(myComparer); } }
/// <summary> /// Sort method /// </summary> /// <param name="sortDirection"> /// Pass in "Asc" for ascending or "Desc" for descending /// </param> public void Sort(string sortDirection) { if(sortDirection == null) { throw new ArgumentNullException("You must pass in \"Asc\" for ascending or \"Desc\" for descending"); } else if(!sortDirection.Equals("Asc") && !sortDirection.Equals("Desc")) { throw new ArgumentException("You must pass in \"Asc\" for ascending or \"Desc\" for descending"); } if(sortDirection.Equals("Asc")) { InnerList.Sort(); } else if(sortDirection.Equals("Desc")) { IComparer myComparer = new CollectionReverseSort(); InnerList.Sort(myComparer); } }