ArrayHelper
Utility class for common array operations.
方法
public static void Clear(Array array)
ArrayHelper.Clear(array)
Sets all of the elements in the specified Array to zero, false, or null, depending on the element type.
- array
- The array whose elements need to be cleared.
public static void Clear(Array array, int index, int count)
ArrayHelper.Clear(array, index, count)
Sets a range of elements in the specified Array to zero, false, or null, depending on the element type.
- array
- The array whose elements need to be cleared.
- index
- The starting index of the range of elements to clear.
- count
- The number of elements to clear.
public static T[] Concat<T>(T[] first, T[] second)
result = ArrayHelper.Concat(first, second)
Concatenates two arrays into a single new array.
- first
- The first array to concatenate.
- second
- The second array to concatenate.
返回值: A new array that contains the elements of the first array followed by the elements of the second array.
public static Array CreateArray(Type type, int count)
result = ArrayHelper.CreateArray(type, count)
Creates a one-dimensional Array of the specified Type and length, with zero-based indexing.
- type
- The type of the array to create.
- count
- The size of the array to create.
返回值: A new array of the specified type and length.
public static int IndexOf<T>(T[] array, T item)
result = ArrayHelper.IndexOf(array, item)
Searches for the specified object and returns the index of the first occurrence within the entire one-dimensional array.
- array
- The one-dimensional array to search.
- item
- The object to locate in the array.
返回值: The index of the first occurrence of value within the entire array, if found; otherwise, the lower bound of the array minus 1.