Class Extensions_Collections
Extensions for collections (Clear, SetItemsCount, Fill, etc.)
Inherited Members
Namespace: Fwt.Core
Assembly: fwt.core.dll
Syntax
[BurstCompile]
public static class Extensions_Collections
Methods
ClearNativeHashMapAsync<TKey, TItem>(NativeHashMap<TKey, TItem>, JobHandle)
Clears a NativeList. Schedules a job and returns a JobHandle to it.
Declaration
[BurstCompile]
public static JobHandle ClearNativeHashMapAsync<TKey, TItem>(this NativeHashMap<TKey, TItem> items, JobHandle dependency) where TKey : unmanaged, IEquatable<TKey> where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeHashMap<TKey, TItem> | items | the collection to clear |
| JobHandle | dependency | dependency for a job that will be scheduled |
Returns
| Type | Description |
|---|---|
| JobHandle | JobHandle to the scheduled job |
Type Parameters
| Name | Description |
|---|---|
| TKey | Type of key in a HashMap |
| TItem | Type of item in a collection |
ClearNativeHashSetAsync<TKey>(NativeHashSet<TKey>, JobHandle)
Clears a NativeList. Schedules a job and returns a JobHandle to it.
Declaration
[BurstCompile]
public static JobHandle ClearNativeHashSetAsync<TKey>(this NativeHashSet<TKey> items, JobHandle dependency) where TKey : unmanaged, IEquatable<TKey>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeHashSet<TKey> | items | the collection to clear |
| JobHandle | dependency | dependency for a job that will be scheduled |
Returns
| Type | Description |
|---|---|
| JobHandle | JobHandle to the scheduled job |
Type Parameters
| Name | Description |
|---|---|
| TKey | Type of key in a HashSet |
ClearNativeParallelHashMapAsync<TKey, TItem>(NativeParallelHashMap<TKey, TItem>, JobHandle)
Clears a NativeParallelHashMap. Schedules a job and returns a JobHandle to it.
Declaration
[BurstCompile]
public static JobHandle ClearNativeParallelHashMapAsync<TKey, TItem>(this NativeParallelHashMap<TKey, TItem> items, JobHandle dependency) where TKey : unmanaged, IEquatable<TKey> where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeParallelHashMap<TKey, TItem> | items | the collection to clear |
| JobHandle | dependency | dependency for a job that will be scheduled |
Returns
| Type | Description |
|---|---|
| JobHandle | JobHandle to the scheduled job |
Type Parameters
| Name | Description |
|---|---|
| TKey | Type of key in a HashMap |
| TItem | Type of item in a collection |
ClearNativeParallelHashSetAsync<TKey>(NativeParallelHashSet<TKey>, JobHandle)
Clears a NativeParallelHashSet. Schedules a job and returns a JobHandle to it.
Declaration
[BurstCompile]
public static JobHandle ClearNativeParallelHashSetAsync<TKey>(this NativeParallelHashSet<TKey> items, JobHandle dependency) where TKey : unmanaged, IEquatable<TKey>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeParallelHashSet<TKey> | items | the collection to clear |
| JobHandle | dependency | dependency for a job that will be scheduled |
Returns
| Type | Description |
|---|---|
| JobHandle | JobHandle to the scheduled job |
Type Parameters
| Name | Description |
|---|---|
| TKey | Type of key in a HashSet |
ClearNativeParallelMultiHashMapAsync<TKey, TItem>(NativeParallelMultiHashMap<TKey, TItem>, JobHandle)
Clears a NativeParallelMultiHashMap. Schedules a job and returns a JobHandle to it.
Declaration
[BurstCompile]
public static JobHandle ClearNativeParallelMultiHashMapAsync<TKey, TItem>(this NativeParallelMultiHashMap<TKey, TItem> items, JobHandle dependency) where TKey : unmanaged, IEquatable<TKey> where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeParallelMultiHashMap<TKey, TItem> | items | the collection to clear |
| JobHandle | dependency | dependency for a job that will be scheduled |
Returns
| Type | Description |
|---|---|
| JobHandle | JobHandle to the scheduled job |
Type Parameters
| Name | Description |
|---|---|
| TKey | Type of key in a HashMap |
| TItem | Type of item in a collection |
Clone<TItem>(NativeArray<TItem>, Allocator)
Clone a NativeArray to a new NativeArray with the same items
Declaration
[BurstCompile]
public static NativeArray<TItem> Clone<TItem>(this NativeArray<TItem> source, Allocator allocator) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TItem> | source | Where to copy data from |
| Allocator | allocator | Allocator to create a new collection with |
Returns
| Type | Description |
|---|---|
| NativeArray<TItem> | newly created collection |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of items in the collection |
Clone<TItem>(NativeList<TItem>, Allocator)
Clone a NativeList to a new NativeList with the same items
Declaration
[BurstCompile]
public static NativeList<TItem> Clone<TItem>(this NativeList<TItem> source, Allocator allocator) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | source | Where to copy data from |
| Allocator | allocator | Allocator to create a new collection with |
Returns
| Type | Description |
|---|---|
| NativeList<TItem> | newly created collection |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of items in the collection |
CopyToAndConvert_Reverse<TSource, TTarget>(NativeList<TSource>, NativeList<TTarget>)
Tries to copy items from one collection to another, converting values while copying. If the collections are not created or have different lengths, it will do nothing. Copies data in reverse. Schedules a job and waits for it to complete.
Declaration
[BurstCompile]
public static bool CopyToAndConvert_Reverse<TSource, TTarget>(this NativeList<TSource> source, NativeList<TTarget> target) where TSource : unmanaged, IConvertableFrom<TSource, TTarget> where TTarget : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TSource> | source | source collection |
| NativeList<TTarget> | target | target collection |
Returns
| Type | Description |
|---|---|
| bool | true if successfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TSource | Type of item in a source collection |
| TTarget | Type of item in a target collection |
CopyToAndConvert_Reverse<TSource, TTarget>(NativeList<TSource>, NativeList<TTarget>, out JobHandle)
Tries to copy items from one collection to another, converting values while copying. If the collections are not created or have different lengths, it will do nothing. Copies data in reverse. Schedules a job and waits for it to complete.
Declaration
[BurstCompile]
public static bool CopyToAndConvert_Reverse<TSource, TTarget>(this NativeList<TSource> source, NativeList<TTarget> target, out JobHandle jobHandle) where TSource : unmanaged, IConvertableFrom<TSource, TTarget> where TTarget : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TSource> | source | source collection |
| NativeList<TTarget> | target | target collection |
| JobHandle | jobHandle |
Returns
| Type | Description |
|---|---|
| bool | true if successfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TSource | Type of item in a source collection |
| TTarget | Type of item in a target collection |
CopyToAndConvert<TSource, TTarget>(NativeList<TSource>, NativeList<TTarget>)
Tries to copy items from one collection to another, converting values while copying. If the collections are not created or have different lengths, it will do nothing.
Declaration
[BurstCompile]
public static bool CopyToAndConvert<TSource, TTarget>(this NativeList<TSource> source, NativeList<TTarget> target) where TSource : unmanaged where TTarget : unmanaged, IConvertableTo<TSource>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TSource> | source | source collection to copy data FROM |
| NativeList<TTarget> | target | target collection to copy data TO |
Returns
| Type | Description |
|---|---|
| bool | True if successfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TSource | Type of item in a source collection |
| TTarget | Type of item in a target collection |
CopyToAndConvert<TSource, TTarget>(NativeList<TSource>, NativeList<TTarget>, out JobHandle)
Tries to copy items from one collection to another, converting values while copying. If the collections are not created or have different lengths, it will do nothing.
Declaration
[BurstCompile]
public static bool CopyToAndConvert<TSource, TTarget>(this NativeList<TSource> source, NativeList<TTarget> target, out JobHandle jobHandle) where TSource : unmanaged where TTarget : unmanaged, IConvertableTo<TSource>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TSource> | source | source collection to copy data FROM |
| NativeList<TTarget> | target | target collection to copy data TO |
| JobHandle | jobHandle | Schedules a job. This is a job handle of the scheduled job |
Returns
| Type | Description |
|---|---|
| bool | True if successfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TSource | Type of item in a source collection |
| TTarget | Type of item in a target collection |
FillArrayAsync<TItem>(NativeArray<TItem>, TItem, JobHandle)
Fill every cell in collection with provided value. Schedules a job and returns a JobHandle.
Declaration
[BurstCompile]
public static JobHandle FillArrayAsync<TItem>(this NativeArray<TItem> target, TItem item, JobHandle dependency) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TItem> | target | collection to fill |
| TItem | item | item value to put in every cell |
| JobHandle | dependency | function schedules a job, so this JobHandle is used as dependency in that job |
Returns
| Type | Description |
|---|---|
| JobHandle | JobHandle to the job that fills a collection |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
FillArray<TItem>(NativeArray<TItem>, TItem, JobHandle)
Fill every cell in collection with provided value. Schedules a job and waits for it to complete.
Declaration
[BurstCompile]
public static void FillArray<TItem>(this NativeArray<TItem> target, TItem item, JobHandle dependency = default) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TItem> | target | collection to fill |
| TItem | item | item value to put in every cell |
| JobHandle | dependency | function schedules a job, so this JobHandle is used as dependency in that job |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
FillListAsync<TItem>(NativeList<TItem>, TItem, JobHandle)
Fill every cell in collection with provided value. Schedules a job and returns a JobHandle.
Declaration
[BurstCompile]
public static JobHandle FillListAsync<TItem>(this NativeList<TItem> target, TItem item, JobHandle dependency) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | target | collection to fill |
| TItem | item | item value to put in every cell |
| JobHandle | dependency | function schedules a job, so this JobHandle is used as dependency in that job |
Returns
| Type | Description |
|---|---|
| JobHandle | JobHandle to the job that fills a collection |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
FillList<TItem>(List<TItem>, TItem)
Fill every cell in collection with provided value.
Declaration
public static void FillList<TItem>(this List<TItem> target, TItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| List<TItem> | target | collection to fill |
| TItem | item | item value to put in every cell |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
FillList<TItem>(NativeList<TItem>, TItem, JobHandle)
Fill every cell in collection with provided value. Schedules a job and waits for it to complete.
Declaration
[BurstCompile]
public static void FillList<TItem>(this NativeList<TItem> target, TItem item, JobHandle dependency = default) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | target | collection to fill |
| TItem | item | item value to put in every cell |
| JobHandle | dependency | function schedules a job, so this JobHandle is used as dependency in that job |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
GetRandom<TItem>(IList<TItem>)
Get a random item from the list
Declaration
public static TItem GetRandom<TItem>(this IList<TItem> list)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<TItem> | list | list to get an item from |
Returns
| Type | Description |
|---|---|
| TItem | random item from the list. If list is null or empty, returns default |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the list |
SetItemsCount<TItem>(List<TItem>, int, bool)
Set the count of items in a Array. If the count is less than the current length, it will remove items from the end.
Declaration
public static bool SetItemsCount<TItem>(this List<TItem> buffer, int count, bool changeCapacity = true)
Parameters
| Type | Name | Description |
|---|---|---|
| List<TItem> | buffer | collection to resize |
| int | count | target count of items in the collection |
| bool | changeCapacity | If true, sets the Capacity equals to the items count |
Returns
| Type | Description |
|---|---|
| bool | True if succesfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of items in the collection |
SetItemsCount<TItem>(NativeList<TItem>, int, bool)
Set the count of items in a NativeList. If the count is less than the current length, it will remove items from the end.
Declaration
[BurstCompile]
public static bool SetItemsCount<TItem>(this NativeList<TItem> buffer, int count, bool changeCapacity = true) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | buffer | collection to resize |
| int | count | target count of items in the collection |
| bool | changeCapacity | If true, sets the Capacity equals to the items count |
Returns
| Type | Description |
|---|---|
| bool | True if succesfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of items in the collection |
TryCloneToList<TItem>(NativeArray<TItem>, Allocator)
Tries to clone a collection (if it is created) to a new collection with the same items.
Declaration
[BurstCompile]
public static NativeList<TItem> TryCloneToList<TItem>(this NativeArray<TItem> source, Allocator allocator) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TItem> | source | collection to clone |
| Allocator | allocator | allocator to create a clone collection with |
Returns
| Type | Description |
|---|---|
| NativeList<TItem> | newly created collection |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryClone<TItem>(NativeArray<TItem>, Allocator)
Tries to clone a collection (if it is created) to a new collection with the same items.
Declaration
[BurstCompile]
public static NativeArray<TItem> TryClone<TItem>(this NativeArray<TItem> source, Allocator allocator) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TItem> | source | collection to clone |
| Allocator | allocator | allocator to create a clone collection with |
Returns
| Type | Description |
|---|---|
| NativeArray<TItem> | newly created collection |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryClone<TItem>(NativeList<TItem>, Allocator)
Tries to clone a collection (if it is created) to a new collection with the same items.
Declaration
[BurstCompile]
public static NativeList<TItem> TryClone<TItem>(this NativeList<TItem> source, Allocator allocator) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | source | collection to clone |
| Allocator | allocator | allocator to create a clone collection with |
Returns
| Type | Description |
|---|---|
| NativeList<TItem> | newly created collection |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryCopy<TItem>(NativeArray<TItem>, NativeArray<TItem>)
Tries to copy items from one collection to another. If the collections are not created or have different lengths, it will do nothing.
Declaration
[BurstCompile]
public static void TryCopy<TItem>(this NativeArray<TItem> target, NativeArray<TItem> source) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TItem> | target | Collection to copy TO |
| NativeArray<TItem> | source | Collection to copy FROM |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryCopy<TItem>(NativeList<TItem>, NativeArray<TItem>)
Tries to copy items from one collection to another. If the collections are not created or have different lengths, it will do nothing.
Declaration
[BurstCompile]
public static void TryCopy<TItem>(this NativeList<TItem> target, NativeArray<TItem> source) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | target | Collection to copy TO |
| NativeArray<TItem> | source | Collection to copy FROM |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryCopy<TItem>(NativeList<TItem>, NativeList<TItem>)
Tries to copy items from one collection to another. If the collections are not created or have different lengths, it will do nothing.
Declaration
[BurstCompile]
public static void TryCopy<TItem>(this NativeList<TItem> target, NativeList<TItem> source) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | target | Collection to copy TO |
| NativeList<TItem> | source | Collection to copy FROM |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryDispose<TItem>(NativeArray<TItem>)
Try to dispose a NativeArray. If the array is not created, it will do nothing.
Declaration
[BurstCompile]
public static void TryDispose<TItem>(this NativeArray<TItem> source) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TItem> | source | collection to dispose |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryDispose<TItem>(NativeHashSet<TItem>)
Try to dispose a NativeHashSet. If the set is not created, it will do nothing.
Declaration
[BurstCompile]
public static void TryDispose<TItem>(this NativeHashSet<TItem> source) where TItem : unmanaged, IEquatable<TItem>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeHashSet<TItem> | source | a collection to dispose |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in a hash set |
TryDispose<TItem>(NativeList<TItem>)
Try to dispose a NativeList. If the list is not created, it will do nothing.
Declaration
[BurstCompile]
public static void TryDispose<TItem>(this NativeList<TItem> source) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | source | collection to dispose |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryDispose<TItem>(NativeParallelHashSet<TItem>)
Try to dispose a NativeHashSet. If the set is not created, it will do nothing.
Declaration
[BurstCompile]
public static void TryDispose<TItem>(this NativeParallelHashSet<TItem> source) where TItem : unmanaged, IEquatable<TItem>
Parameters
| Type | Name | Description |
|---|---|---|
| NativeParallelHashSet<TItem> | source | a collection to dispose |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in a hash set |
TryDispose<TKey, TItem>(NativeHashMap<TKey, TItem>)
Try to dispose a NativeHashMap. If the map is not created, it will do nothing.
Declaration
[BurstCompile]
public static void TryDispose<TKey, TItem>(this NativeHashMap<TKey, TItem> source) where TKey : unmanaged, IEquatable<TKey> where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeHashMap<TKey, TItem> | source | a collection to dispose |
Type Parameters
| Name | Description |
|---|---|
| TKey | Type of key in a hash set |
| TItem | Type of item in a hash set |
TryDispose<TKey, TItem>(NativeParallelHashMap<TKey, TItem>)
Try to dispose a NativeHashMap. If the map is not created, it will do nothing.
Declaration
[BurstCompile]
public static void TryDispose<TKey, TItem>(this NativeParallelHashMap<TKey, TItem> source) where TKey : unmanaged, IEquatable<TKey> where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeParallelHashMap<TKey, TItem> | source | a collection to dispose |
Type Parameters
| Name | Description |
|---|---|
| TKey | Type of key in a hash set |
| TItem | Type of item in a hash set |
TryDispose<TKey, TItem>(NativeParallelMultiHashMap<TKey, TItem>)
Try to dispose a NativeHashSet. If the set is not created, it will do nothing.
Declaration
[BurstCompile]
public static void TryDispose<TKey, TItem>(this NativeParallelMultiHashMap<TKey, TItem> source) where TKey : unmanaged, IEquatable<TKey> where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeParallelMultiHashMap<TKey, TItem> | source | a collection to dispose |
Type Parameters
| Name | Description |
|---|---|
| TKey | Type of key in a hash set |
| TItem | Type of item in a hash set |
TryGetItemOrDefault<TItem>(IList<TItem>, int)
Tries to get an item from a collection. If the collection is not created or the index is out of range, it will return default(TItem).
Declaration
[BurstCompile]
public static TItem TryGetItemOrDefault<TItem>(this IList<TItem> source, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<TItem> | source | collection to get an item from |
| int | index | index of item to get |
Returns
| Type | Description |
|---|---|
| TItem | item at requested index or default(TItem) if nothing found |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryGetItemOrDefault<TItem>(NativeArray<TItem>, int)
Tries to get an item from a collection. If the collection is not created or the index is out of range, it will return default(TItem).
Declaration
[BurstCompile]
public static TItem TryGetItemOrDefault<TItem>(this NativeArray<TItem> source, int index) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TItem> | source | collection to get an item from |
| int | index | index of item to get |
Returns
| Type | Description |
|---|---|
| TItem | item at requested index or default(TItem) if nothing found |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryGetItemOrDefault<TItem>(NativeList<TItem>, int)
Tries to get an item from a collection. If the collection is not created or the index is out of range, it will return default(TItem).
Declaration
[BurstCompile]
public static TItem TryGetItemOrDefault<TItem>(this NativeList<TItem> source, int index) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | source | collection to get an item from |
| int | index | index of item to get |
Returns
| Type | Description |
|---|---|
| TItem | item at requested index or default(TItem) if nothing found |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryGetItemOrDefault<TItem>(TItem[], int)
Tries to get an item from a collection. If the collection is not created or the index is out of range, it will return default(TItem).
Declaration
[BurstCompile]
public static TItem TryGetItemOrDefault<TItem>(this TItem[] source, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem[] | source | collection to get an item from |
| int | index | index of item to get |
Returns
| Type | Description |
|---|---|
| TItem | item at requested index or default(TItem) if nothing found |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryGetItem<TItem>(IList<TItem>, int, out TItem)
Tries to get an item from a collection. If the collection is not created or the index is out of range, it will return false.
Declaration
[BurstCompile]
public static bool TryGetItem<TItem>(this IList<TItem> source, int index, out TItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<TItem> | source | collection to get an item from |
| int | index | index of item to get |
| TItem | item | result value. Default if nothing found |
Returns
| Type | Description |
|---|---|
| bool | true if successfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryGetItem<TItem>(NativeArray<TItem>, int, out TItem)
Tries to get an item from a collection. If the collection is not created or the index is out of range, it will return false.
Declaration
[BurstCompile]
public static bool TryGetItem<TItem>(this NativeArray<TItem> source, int index, out TItem item) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeArray<TItem> | source | collection to get an item from |
| int | index | index of item to get |
| TItem | item | result value. Default if nothing found |
Returns
| Type | Description |
|---|---|
| bool | true if successfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryGetItem<TItem>(NativeList<TItem>, int, out TItem)
Tries to get an item from a collection. If the collection is not created or the index is out of range, it will return false.
Declaration
[BurstCompile]
public static bool TryGetItem<TItem>(this NativeList<TItem> source, int index, out TItem item) where TItem : unmanaged
Parameters
| Type | Name | Description |
|---|---|---|
| NativeList<TItem> | source | collection to get an item from |
| int | index | index of item to get |
| TItem | item | result value. Default if nothing found |
Returns
| Type | Description |
|---|---|
| bool | true if successfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |
TryGetItem<TItem>(TItem[], int, out TItem)
Tries to get an item from a collection. If the collection is not created or the index is out of range, it will return false.
Declaration
[BurstCompile]
public static bool TryGetItem<TItem>(this TItem[] source, int index, out TItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| TItem[] | source | collection to get an item from |
| int | index | index of item to get |
| TItem | item | result value. Default if nothing found |
Returns
| Type | Description |
|---|---|
| bool | true if successfull, otherwise - false |
Type Parameters
| Name | Description |
|---|---|
| TItem | Type of item in the collection |