Class NativeSortExtension
Extension methods for sorting collections.
Namespace: Unity.Collections
Assembly: Unity.Collections.dll
Syntax
public static class NativeSortExtension
Methods
BinarySearch<T>(ReadOnlySpan<T>, T)
Finds a value in this sorted ReadOnlySpan by binary search.
Declaration
public static int BinarySearch<T>(this ReadOnlySpan<T> roSpan, T value) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | roSpan | The ReadOnlySpan to search. |
| T | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
If this ReadOnlySpan is not sorted, the value might not be found, even if it's present in this ReadOnlySpan.
BinarySearch<T>(UnsafeList<T>, T)
Finds a value in this sorted list by binary search.
Declaration
public static int BinarySearch<T>(this UnsafeList<T> container, T value) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| UnsafeList<T> | container | The list to search. |
| T | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
If this list is not sorted, the value might not be found, even if it's present in this list.
BinarySearch<T>(NativeArray<T>, T)
Finds a value in this sorted array by binary search.
Declaration
public static int BinarySearch<T>(this NativeArray<T> array, T value) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T> | array | The array to search. |
| T | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
If the array is not sorted, the value might not be found, even if it's present in this array.
BinarySearch<T>(ReadOnly, T)
Finds a value in this sorted array by binary search.
Declaration
public static int BinarySearch<T>(this NativeArray<T>.ReadOnly container, T value) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T>.ReadOnly | container | The array to search. |
| T | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
If the array is not sorted, the value might not be found, even if it's present in this array.
BinarySearch<T>(NativeList<T>, T)
Finds a value in this sorted list by binary search.
Declaration
public static int BinarySearch<T>(this NativeList<T> container, T value) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | container | The list to search. |
| T | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
If this list is not sorted, the value might not be found, even if it's present in this list.
BinarySearch<T>(NativeSlice<T>, T)
Finds a value in this sorted slice by binary search.
Declaration
public static int BinarySearch<T>(this NativeSlice<T> container, T value) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeSlice<T> | container | The slice to search. |
| T | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
If this slice is not sorted, the value might not be found, even if it's present in this slice.
BinarySearch<T>(T*, int, T)
Finds a value in a sorted array by binary search.
Declaration
public static int BinarySearch<T>(T* ptr, int length, T value) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T* | ptr | The array to search. |
| int | length | The number of elements to search. Indexes greater than or equal to |
| T | value | The value to locate. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
If the array is not sorted, the value might not be found, even if it's present in the array.
BinarySearch<T, U>(ReadOnlySpan<T>, T, U)
Finds a value in this sorted ReadOnlySpan by binary search using a custom comparison.
Declaration
public static int BinarySearch<T, U>(this ReadOnlySpan<T> roSpan, T value, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<T> | roSpan | The ReadOnlySpan to search. |
| T | value | The value to locate. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
If this ReadOnlySpan is not sorted, the value might not be found, even if it's present in this ReadOnlySpan.
BinarySearch<T, U>(UnsafeList<T>, T, U)
Finds a value in this sorted list by binary search using a custom comparison.
Declaration
public static int BinarySearch<T, U>(this UnsafeList<T> container, T value, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| UnsafeList<T> | container | The list to search. |
| T | value | The value to locate. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
If this list is not sorted, the value might not be found, even if it's present in this list.
BinarySearch<T, U>(NativeArray<T>, T, U)
Finds a value in this sorted array by binary search using a custom comparison.
Declaration
public static int BinarySearch<T, U>(this NativeArray<T> container, T value, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T> | container | The array to search. |
| T | value | The value to locate. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The comparer type. |
Remarks
If the array is not sorted, the value might not be found, even if it's present in this array.
BinarySearch<T, U>(ReadOnly, T, U)
Finds a value in this sorted array by binary search using a custom comparison.
Declaration
public static int BinarySearch<T, U>(this NativeArray<T>.ReadOnly container, T value, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T>.ReadOnly | container | The array to search. |
| T | value | The value to locate. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The comparer type. |
Remarks
If the array is not sorted, the value might not be found, even if it's present in this array.
BinarySearch<T, U>(NativeList<T>, T, U)
Finds a value in this sorted list by binary search using a custom comparison.
Declaration
public static int BinarySearch<T, U>(this NativeList<T> container, T value, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | container | The list to search. |
| T | value | The value to locate. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
If this list is not sorted, the value may not be found, even if it's present in this list.
BinarySearch<T, U>(NativeSlice<T>, T, U)
Finds a value in this sorted slice by binary search using a custom comparison.
Declaration
public static int BinarySearch<T, U>(this NativeSlice<T> container, T value, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeSlice<T> | container | The slice to search. |
| T | value | The value to locate. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
If this slice is not sorted, the value might not be found, even if it's present in this slice.
BinarySearch<T, U>(T*, int, T, U)
Finds a value in a sorted array by binary search using a custom comparison.
Declaration
public static int BinarySearch<T, U>(T* ptr, int length, T value, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T* | ptr | The array to search. |
| int | length | The number of elements to search. Indexes greater than or equal to |
| T | value | The value to locate. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| int | If found, the index of the located value. If not found, the return value is negative. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
If the array is not sorted, the value might not be found, even if it's present in the array.
SortIndices<T>(Span<int>, ReadOnlySpan<T>)
Sorts a span of indices by comparing a read-only span of values of type T, using a custom comparer.
Declaration
public static void SortIndices<T>(this Span<int> indices, ReadOnlySpan<T> values) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| Span<int> | indices | Indices to sort. Indices must be unique, nonnegative, and strictly less than the length of values. |
| ReadOnlySpan<T> | values | Values to use for sorting. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
SortIndices<T, U>(Span<int>, ReadOnlySpan<T>, U)
Sorts a span of indices by comparing a read-only span of values of type T, using a custom comparer.
Declaration
public static void SortIndices<T, U>(this Span<int> indices, ReadOnlySpan<T> values, U comp) where T : unmanaged, IComparable<T> where U : unmanaged, IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| Span<int> | indices | Indices to sort. Indices must be unique, nonnegative, and strictly less than the length of values. |
| ReadOnlySpan<T> | values | Values to use for sorting. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
SortJobDefer<T>(NativeList<T>)
Returns a job which will sort this list in ascending order.
Declaration
public static SortJobDefer<T, NativeSortExtension.DefaultComparer<T>> SortJobDefer<T>(this NativeList<T> container) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | container | The list to sort. |
Returns
| Type | Description |
|---|---|
| SortJobDefer<T, NativeSortExtension.DefaultComparer<T>> | A job for sorting this list. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
SortJobDefer is intended for use when NativeList.Length is not known at scheduling time,
and it depends on completion of previosly scheduled job(s).
This method does not schedule the job. Scheduling the job is left to you.
SortJobDefer<T, U>(NativeList<T>, U)
Returns a job which will sort this list using a custom comparison.
Declaration
public static SortJobDefer<T, U> SortJobDefer<T, U>(this NativeList<T> container, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | container | The list to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| SortJobDefer<T, U> | A job for sorting this list. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
SortJobDefer is intended for use when NativeList.Length is not known at scheduling time,
and it depends on completion of previosly scheduled job(s).
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T>(Span<T>)
Returns a job which will sort this span in ascending order.
Declaration
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this Span<T> span) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | span | The span to sort. |
Returns
| Type | Description |
|---|---|
| SortJob<T, NativeSortExtension.DefaultComparer<T>> | A job for sorting this array. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T>(UnsafeList<T>)
Returns a job which will sort this list in ascending order.
Declaration
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this UnsafeList<T> container) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| UnsafeList<T> | container | The list to sort. |
Returns
| Type | Description |
|---|---|
| SortJob<T, NativeSortExtension.DefaultComparer<T>> | A job for sorting this list. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T>(NativeArray<T>)
Returns a job which will sort this array in ascending order.
Declaration
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this NativeArray<T> container) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T> | container | The array to sort. |
Returns
| Type | Description |
|---|---|
| SortJob<T, NativeSortExtension.DefaultComparer<T>> | A job for sorting this array. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T>(NativeList<T>)
Returns a job which will sort this list in ascending order.
Declaration
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this NativeList<T> container) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | container | The list to sort. |
Returns
| Type | Description |
|---|---|
| SortJob<T, NativeSortExtension.DefaultComparer<T>> | A job for sorting this list. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
When NativeList.Length is not known at scheduling time use SortJobDefer instead.
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T>(NativeSlice<T>)
Returns a job which will sort this slice in ascending order.
Declaration
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(this NativeSlice<T> container) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeSlice<T> | container | The slice to sort. |
Returns
| Type | Description |
|---|---|
| SortJob<T, NativeSortExtension.DefaultComparer<T>> | A job for sorting this slice. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T>(T*, int)
Returns a job which will sort an array in ascending order.
Declaration
public static SortJob<T, NativeSortExtension.DefaultComparer<T>> SortJob<T>(T* ptr, int length) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T* | ptr | The array to sort. |
| int | length | The number of elements to sort in the array.
Indexes greater than or equal to |
Returns
| Type | Description |
|---|---|
| SortJob<T, NativeSortExtension.DefaultComparer<T>> | A job for sorting the array. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T, U>(Span<T>, U)
Returns a job which will sort this span using a custom comparison.
Declaration
public static SortJob<T, U> SortJob<T, U>(this Span<T> span, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | span | The span to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| SortJob<T, U> | A job for sorting the array. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T, U>(UnsafeList<T>, U)
Returns a job which will sort this list using a custom comparison.
Declaration
public static SortJob<T, U> SortJob<T, U>(this UnsafeList<T> container, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| UnsafeList<T> | container | The list to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| SortJob<T, U> | A job for sorting this list. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T, U>(NativeArray<T>, U)
Returns a job which will sort this array using a custom comparison.
Declaration
public static SortJob<T, U> SortJob<T, U>(this NativeArray<T> container, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T> | container | The array to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| SortJob<T, U> | A job for sorting the array. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T, U>(NativeList<T>, U)
Returns a job which will sort this list using a custom comparison.
Declaration
public static SortJob<T, U> SortJob<T, U>(this NativeList<T> container, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | container | The list to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| SortJob<T, U> | A job for sorting this list. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
When NativeList.Length is not known at scheduling time use SortJobDefer instead.
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T, U>(NativeSlice<T>, U)
Returns a job which will sort this slice using a custom comparison.
Declaration
public static SortJob<T, U> SortJob<T, U>(this NativeSlice<T> container, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeSlice<T> | container | The slice to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| SortJob<T, U> | A job for sorting this slice. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
SortJob<T, U>(T*, int, U)
Returns a job which will sort an array using a custom comparison.
Declaration
public static SortJob<T, U> SortJob<T, U>(T* ptr, int length, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T* | ptr | The array to sort. |
| int | length | The number of elements to sort in the array.
Indexes greater than or equal to |
| U | comp | The comparison function used to determine the relative order of the elements. |
Returns
| Type | Description |
|---|---|
| SortJob<T, U> | A job for sorting the array. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Remarks
This method does not schedule the job. Scheduling the job is left to you.
Sort<T>(Span<T>)
Sorts this span in ascending order.
Declaration
public static void Sort<T>(this Span<T> span) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | span | The span to sort. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Sort<T>(UnsafeList<T>)
Sorts this list in ascending order.
Declaration
public static void Sort<T>(this UnsafeList<T> container) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| UnsafeList<T> | container | The list to sort. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Sort<T>(NativeArray<T>)
Sorts this array in ascending order.
Declaration
public static void Sort<T>(this NativeArray<T> container) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T> | container | The array to sort. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Sort<T>(NativeList<T>)
Sorts this list in ascending order.
Declaration
public static void Sort<T>(this NativeList<T> container) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | container | The list to sort. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Sort<T>(NativeSlice<T>)
Sorts this slice in ascending order.
Declaration
public static void Sort<T>(this NativeSlice<T> container) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeSlice<T> | container | The slice to sort. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Sort<T>(T*, int)
Sorts an array in ascending order.
Declaration
public static void Sort<T>(T* ptr, int length) where T : unmanaged, IComparable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T* | ptr | The array to sort. |
| int | length | The number of elements to sort in the array.
Indexes greater than or equal to |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
Sort<T, U>(Span<T>, U)
Sorts this span using a custom comparison.
Declaration
public static void Sort<T, U>(this Span<T> span, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| Span<T> | span | The span to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Sort<T, U>(UnsafeList<T>, U)
Sorts the list using a custom comparison.
Declaration
public static void Sort<T, U>(this UnsafeList<T> container, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| UnsafeList<T> | container | The list to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Sort<T, U>(NativeArray<T>, U)
Sorts this array using a custom comparison.
Declaration
public static void Sort<T, U>(this NativeArray<T> container, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<T> | container | The array to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Sort<T, U>(NativeList<T>, U)
Sorts this list using a custom comparison.
Declaration
public static void Sort<T, U>(this NativeList<T> container, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<T> | container | The list to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Sort<T, U>(NativeSlice<T>, U)
Sorts this slice using a custom comparison.
Declaration
public static void Sort<T, U>(this NativeSlice<T> container, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeSlice<T> | container | The slice to sort. |
| U | comp | The comparison function used to determine the relative order of the elements. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |
Sort<T, U>(T*, int, U)
Sorts an array using a custom comparison.
Declaration
public static void Sort<T, U>(T* ptr, int length, U comp) where T : unmanaged where U : IComparer<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T* | ptr | The array to sort. |
| int | length | The number of elements to sort in the array.
Indexes greater than or equal to |
| U | comp | The comparison function used to determine the relative order of the elements. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the elements. |
| U | The type of the comparer. |