mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-26 05:50:18 +00:00
...
This commit is contained in:
parent
0ebaef839a
commit
c1cf249e8a
1 changed files with 12 additions and 0 deletions
|
@ -32,6 +32,18 @@ namespace SanAndreasUnity.Utilities
|
||||||
return queue;
|
return queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static T[] ToArrayOfLength<T>(this IEnumerable<T> enumerable, int length)
|
||||||
|
{
|
||||||
|
T[] array = new T[length];
|
||||||
|
int i = 0;
|
||||||
|
foreach (var item in enumerable)
|
||||||
|
{
|
||||||
|
array[i] = item;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
public static IEnumerable<T> AppendIf<T>(this IEnumerable<T> enumerable, bool condition, T element)
|
public static IEnumerable<T> AppendIf<T>(this IEnumerable<T> enumerable, bool condition, T element)
|
||||||
{
|
{
|
||||||
return condition ? enumerable.Append(element) : enumerable;
|
return condition ? enumerable.Append(element) : enumerable;
|
||||||
|
|
Loading…
Reference in a new issue