Assigns a value to the element at the specified position in the one-dimensional Array.
[Visual Basic] Overloads Public Sub SetValue( _ ByVal value As Object, _ ByVal index As Integer _ ) [C#] public void SetValue( object value, int index ); [C++] public: void SetValue( Object* value, int index ); [JScript] public function SetValue( value : Object, index : int );
None.
Exception Type | Condition |
---|---|
ArgumentException | The Array does not have exactly one dimension.
-or- value does not contain a type that can be widened, using the standard widening conversions, to the element type of the Array. |
IndexOutOfRangeException | index is outside the range of valid indices for the Array. |
The GetLowerBound and GetUpperBound methods can be used to determine whether the value of index is out of bounds.
Array Class | Array Members | System Namespace | Array.SetValue Overload List | GetLowerBound | GetUpperBound | GetValue