@ -1,22 +0,0 @@ |
|||||||
namespace Kynareth; |
|
||||||
|
|
||||||
public static class Extensions |
|
||||||
{ |
|
||||||
public static T GetRandomEnumValue<T>() where T : Enum |
|
||||||
=> (T) Enum.GetValues(typeof(T)).OfType<Enum>().OrderBy(_ => Guid.NewGuid()).FirstOrDefault(); |
|
||||||
|
|
||||||
public static IList<int> Range(int start, int stop, int step) |
|
||||||
{ |
|
||||||
var list = new List<int>(); |
|
||||||
|
|
||||||
for (int i = start; i < stop; i += step) { |
|
||||||
list.Add(i); |
|
||||||
} |
|
||||||
|
|
||||||
return list; |
|
||||||
} |
|
||||||
|
|
||||||
public static T[] Except<T>(this T[] array, T specificValue) where T : IComparable { |
|
||||||
return array.Where<T>(val => val.CompareTo(specificValue) != 0).ToArray(); |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,46 @@ |
|||||||
|
using Exsersewo.Common.Extensions; |
||||||
|
|
||||||
|
namespace Kynareth.Extensions; |
||||||
|
|
||||||
|
public static class CollectionExtensions |
||||||
|
{ |
||||||
|
public static ICollection<T> GetRandomAmount<T>(this ICollection<T> stack, int amount) |
||||||
|
{ |
||||||
|
T[] entries = new T[amount]; |
||||||
|
|
||||||
|
for (int x = 0; x < amount; x++) |
||||||
|
{ |
||||||
|
entries[x] = stack.CryptoRandom(); |
||||||
|
} |
||||||
|
|
||||||
|
return entries; |
||||||
|
} |
||||||
|
|
||||||
|
public static ICollection<T> GetRandomAmount<T>(this IEnumerable<T> stack, int amount) |
||||||
|
{ |
||||||
|
T[] entries = new T[amount]; |
||||||
|
|
||||||
|
for (int x = 0; x < amount; x++) |
||||||
|
{ |
||||||
|
entries[x] = stack.CryptoRandom(); |
||||||
|
} |
||||||
|
|
||||||
|
return entries; |
||||||
|
} |
||||||
|
|
||||||
|
public static IList<int> Range(int start, int stop, int step) |
||||||
|
{ |
||||||
|
var list = new List<int>(); |
||||||
|
|
||||||
|
for (int i = start; i < stop; i += step) { |
||||||
|
list.Add(i); |
||||||
|
} |
||||||
|
|
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
public static T[] Except<T>(this T[] array, T specificValue) where T : IComparable |
||||||
|
{ |
||||||
|
return array.Where<T>(val => val.CompareTo(specificValue) != 0).ToArray(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
namespace Kynareth.Extensions; |
||||||
|
|
||||||
|
public static class EnumHelper |
||||||
|
{ |
||||||
|
public static T GetRandomEnumValue<T>() where T : Enum |
||||||
|
=> (T) Enum.GetValues(typeof(T)).OfType<Enum>().OrderBy(_ => Guid.NewGuid()).FirstOrDefault(); |
||||||
|
} |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 422 KiB |
After Width: | Height: | Size: 67 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 1.9 MiB |
After Width: | Height: | Size: 303 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 186 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 242 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 272 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 685 KiB |
After Width: | Height: | Size: 1.0 MiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 183 KiB |
After Width: | Height: | Size: 173 KiB |
After Width: | Height: | Size: 753 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 260 KiB |