NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

9.13.1 ReDim statement

The ReDim statement instantiates a new array. Each clause in the statement must be a variable whose type is an array type or Object and a list of array bounds. The number of the bounds must be consistent with the type of the variable. At runtime, going from left to right, an array is instantiated with the specified bounds and then assigned to each variable. If the variable type is Object, the number of dimensions is the number of dimensions specified, and the array element type is Object. If the given number of dimensions is incompatible with the variable at runtime, a System.InvalidCastException will be thrown.

If the Preserve keyword is specified, then the new size for each dimension except for the rightmost one must be the same as the size of the existing array's. The values in the existing array are copied into the new array: if the new array is smaller, the existing values are discarded; if the new array is bigger, the extra elements will be initialized to the default value of the element type of the array. If the existing array reference is null, then a System.ArgumentNullException will be thrown. If the size of one of the non-rightmost dimensions changes, then a System.ArrayTypeMismatchException will be thrown.

RedimStatement ::= ReDim [ Preserve ] RedimClauses+ StatementTerminator
RedimClauses ::=
 RedimClauses |
 RedimClause , RedimClauses
RedimClause ::= VariableExpression ArrayInitializationModifier