private void InternalCompareSort2(IComparer comparer) { IComparer <T> orderByComparer = null; if (comparer is IComparer <T> ) { orderByComparer = (IComparer <T>)comparer; } else { orderByComparer = new ArrayComparer <T>(comparer); } this._list = this._list.OrderBy(item => item, orderByComparer).ToList(); if (this._from != null) { System.Reflection.MethodInfo compareSortMethod = this._from.GetType().GetMethod("InternalCompareSort2", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); compareSortMethod.Invoke(this._from, new object[] { comparer }); } }
/// <summary> /// /// </summary> public Array <T> sort(Comparison <T> comparison) { ArrayComparer <T> compare = new ArrayComparer <T>(comparison); return(this.sort(compare)); }
/// <summary> /// /// </summary> public Array <T> sort(Func <T, T, Number> fn) { ArrayComparer <T> compare = new ArrayComparer <T>(fn); return(this.sort(compare)); }