public Vector <T> sort(dynamic sortBehavior = null) { IComparer <T> comparer; if (sortBehavior is System.Func <T, T, int> ) { System.Func <T, T, int> func = (System.Func <T, T, int>)sortBehavior; // By definition, we know that the vector only contains type T, // so if the function passed has the exact expected signature, we use the fast path comparer = new TypedFunctionSorter(func); } else if (sortBehavior is Delegate) { comparer = new FunctionSorter(sortBehavior); } else if (sortBehavior is uint) { comparer = new OptionsSorter((uint)sortBehavior); } else { // http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Vector.html#sort%28%29 comparer = new DefaultSorter(); } System.Array.Sort(mArray, 0, (int)mCount, comparer); return(this); }
public Vector <T> sort(dynamic sortBehavior) { if (sortBehavior is Delegate) { var fs = new FunctionSorter(sortBehavior); mList.Sort(fs); return(this); } else if (sortBehavior is uint) { var os = new OptionsSorter((uint)sortBehavior); mList.Sort(os); return(this); } else { throw new System.NotImplementedException(); } }