Class CollectionHelper
Helper methods for collections.
Inheritance
System.Object
CollectionHelper
Namespace: AdrianMiasik.Components.Core.Helpers
Assembly: Assembly-CSharp.dll
Syntax
public static class CollectionHelper
Methods
| Improve this Doc View SourceWrap(Int32, Int32)
Wraps an index within the bounds of a collection.
Declaration
public static int Wrap(int index, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index you are trying to get (can surpass the bounds of your collection, it will divide down to a value within the bounds of your provided collection length as the second param) |
System.Int32 | length | The length of the collection |
Returns
Type | Description |
---|---|
System.Int32 |
Examples
(E.g: You provide index -1 with length 3, you get index (2). This works both negative and positive)