System.Array

This is an abstract base class which means you cannot create an instance of this class
This class provides a CreateInstance method for creating an instance of an array.
The first parameter is the type.
The second parameter is the dimension
Once an array has been created, we can use the SetValue method to add items to an array


System.Array myArray; 
myArray = System.Array.CreateInstance(GetType(string),3);
myArray.SetValue("one",0);
myArray.SetValue("two",1);
myArray.SetValue("three",2);
myArray = System.Array.CreateInstance(GetType(string),3,"one","two","three");

sValue = System.Convert.ToString(myArray.GetValue(2));


Methods/Properties

ClearPublic shared method that sets a range of elements in the array to zero or to a null reference.
CopyOverloaded public shared method that copies a section of one array to another array
GetLengthReturns a 32 bit Integer representing the number of elements in the specified dimension
GetLongLengthReturns a 64 bit Integer representing the number of elements in the specified dimension
GetLowerBoundGet the upper bound of the specified dimension. Starting at the number 0.
GetUpperBoundGet the lower bound of the specified dimension. Starting at the number 0.
GetValueGets the value of the specified element in the array. Starting at the number 1.
IndexOfOverloaded public shared method that returns the index (offset) of the first instance of a value in a one-dimensional array.
IsFixedSizeReturns a value indicating whether the array has a fixed size
IsReadOnlyReturns a value indicating if an array is readonly or not
LastIndexOfOverloaded public shared method that returns the index of the last instance of a value in a one-dimensional array.
LengthPublic property that returns the length of the array. Returns a 32 bit Integer representing the total number of elements in all the dimensions of the array.
LongLengthReturns a 64 bit Integer representing the total number of elements in all the dimensions of the array.
RankReturns the number of dimensions of the array.
Resize 
ReverseOverloaded public shared method that reverses the order of elements in a one dimensional array
SortOverloaded public shared method that sorts the values in a one-dimensional array.



© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext