|
BGC Tools
|
Set of extensions for a list for easier use of ILists More...
Static Public Member Functions | |
| static int | RandomIndex (this IList list) |
| Get a random index from a list More... | |
| static T | RandomValue< T > (this IList list) |
| Get a random value from the list More... | |
| static T | RandomValue< T > (this IList list, params int[] excludeIndicies) |
| Get a random value from the list More... | |
| static void | Shuffle (this IList list) |
| Randomize a list More... | |
| static int | LastIndex (this IList list) |
| Get last index of the list More... | |
| static T | LastVal< T > (this IList list) |
| Get the last element in the list More... | |
| static void | Swap< T > (this IList list, int indexA, int indexB) |
| swap elements in a list More... | |
| static bool | ListsEquivalent< T > (List< T > a, List< T > b) |
| Test if list a and list b are exactly equal More... | |
| static int | GetSequenceHashCode< T > (this IList< T > sequence) |
| https://stackoverflow.com/questions/8094867/good-gethashcode-override-for-list-of-foo-objects-respecting-the-order More... | |
| static int [] | Indexes (this IList list) |
| Get a list of all the valid indexes in the list More... | |
| static bool | SetAdd< T > (this List< T > list, T item) |
| Add an item to a list if it is not already in the list. More... | |
| static bool | SetSub< T > (this List< T > list, T item) |
| Remove all occurrences of item in list More... | |
| static T | Max< T > (this List< T > list, bool verbose=false) |
| Get the maximum value of a list. Best to only use with a list of numbers More... | |
| static T | Min< T > (this List< T > list, bool verbose=false) |
| Get the minimum value of a list. Best to only use with a list of numbers More... | |
| static List< T > | ShallowClone< T > (this List< T > list) |
| Create a shallow copy of the list More... | |
| static void | PrintSelf< T > (this List< T > list) |
| Debug.Log to print out all values of the lists= More... | |
| static List< T > | FindAllInstancesOf< T > (this List< T > list, T value) |
| Finds all instances of an object within a list and returns them More... | |
| static string | Join< T > (this List< T > list, string separator=",") |
| Join a list into a string with a separator of the users choice More... | |
| static string | Join< T > (this T[] arr, string separator) |
| Join an array into a string with a separator of the users choice More... | |
| static bool | TryGetElement< T > (this List< T > list, int index, out T value) |
| Attempts to get an element from an array and returns it. If not, returns default. Outputs the result to the out parameter More... | |
| static bool | Conains< T > (IList list, T val) |
Set of extensions for a list for easier use of ILists
Definition at line 11 of file ListExtensions.cs.
|
inlinestatic |
Checks if the list contains the defined value
| T |
| list | |
| val |
Definition at line 443 of file ListExtensions.cs.
|
inlinestatic |
Finds all instances of an object within a list and returns them
| T |
| list | |
| value |
Definition at line 342 of file ListExtensions.cs.
|
inlinestatic |
|
inlinestatic |
Get a list of all the valid indexes in the list
| list |
Definition at line 188 of file ListExtensions.cs.
|
inlinestatic |
Join a list into a string with a separator of the users choice
| T |
| list | |
| separator | defaults to a comma |
Definition at line 365 of file ListExtensions.cs.
|
inlinestatic |
Join an array into a string with a separator of the users choice
| T |
| arr | |
| separator |
Definition at line 393 of file ListExtensions.cs.
|
inlinestatic |
Get last index of the list
| list |
Definition at line 108 of file ListExtensions.cs.
|
inlinestatic |
Get the last element in the list
| T |
| list |
Definition at line 119 of file ListExtensions.cs.
|
inlinestatic |
Test if list a and list b are exactly equal
| a | |
| b |
Definition at line 144 of file ListExtensions.cs.
|
inlinestatic |
Get the maximum value of a list. Best to only use with a list of numbers
| T |
| list | |
| verbose |
Definition at line 248 of file ListExtensions.cs.
|
inlinestatic |
Get the minimum value of a list. Best to only use with a list of numbers
| T |
| list | |
| verbose |
Definition at line 280 of file ListExtensions.cs.
|
inlinestatic |
Debug.Log to print out all values of the lists=
| T |
| list |
Definition at line 326 of file ListExtensions.cs.
|
inlinestatic |
Get a random index from a list
| T |
| list |
Definition at line 19 of file ListExtensions.cs.
|
inlinestatic |
Get a random value from the list
| T |
| list |
Definition at line 35 of file ListExtensions.cs.
|
inlinestatic |
Get a random value from the list
| T |
| list | |
| excludeIndicies |
Definition at line 55 of file ListExtensions.cs.
|
inlinestatic |
Add an item to a list if it is not already in the list.
| T |
| list | |
| item |
Definition at line 208 of file ListExtensions.cs.
|
inlinestatic |
Remove all occurrences of item in list
| T |
| list | |
| item |
Definition at line 228 of file ListExtensions.cs.
|
inlinestatic |
Create a shallow copy of the list
src: https://stackoverflow.com/questions/222598/how-do-i-clone-a-generic-list-in-c
| T |
| list |
Definition at line 313 of file ListExtensions.cs.
|
inlinestatic |
|
inlinestatic |
swap elements in a list
| T |
| list | |
| indexA | |
| indexB |
Definition at line 131 of file ListExtensions.cs.
|
inlinestatic |
Attempts to get an element from an array and returns it. If not, returns default. Outputs the result to the out parameter
| T |
| list | |
| index | |
| result |
Definition at line 419 of file ListExtensions.cs.
1.8.13