WebApplications.Testing.Data.ObjectRecord.SetValue C# (CSharp) Method

SetValue() public method

Sets the value. of the column with the specified index.
The value is not valid for the specified index.
public SetValue ( int i, object value ) : void
i int The index.
value object The value.
return void
        public void SetValue(int i, object value)
        {
            if ((i < 0) ||
                (i > FieldCount))
                throw new IndexOutOfRangeException(i.ToString(CultureInfo.InvariantCulture));

            // Check to see if value is changing
            if (_columnValues[i] == value)
                return;

            // Validate value
            object sqlValue;
            if (!_recordSetDefinition[i].Validate(value, out sqlValue))
                throw new ArgumentException(
                    string.Format(
                        "Cannot set the value of column '{0}' to {1}.",
                        _recordSetDefinition[i],
                        value == null ? "null" : "'" + value + "'"),
                    "value");

            _columnValues[i] = sqlValue;
        }