src/GenFx.Components/Lists/ListEntityBase.cs
/// <summary>
/// Inserts the value at the specified index.
/// </summary>
/// <param name="index">Index within the list where the value should be inserted.</param>
/// <param name="value">The value to be inserted.</param>
Inserts the value at the specified index.
Inserts the value at the specified index .
public void Insert(int index, object value)
        {
            if (index > this.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(index));
            }
            if (index == this.Length)
            {
                ((IList)this).Add(value);
                return;
            }
            else
            {
                this.Length++;
                for (int i = this.Length - 2; i >= index; i--)
                {
                    this.SetValue(i + 1, this.GetValue(i));
                }
                ((IList)this)[index] = value;
            }
        }
public void Insert ( int index , object value ) { if ( index > this . Length ) { throw new ArgumentOutOfRangeException ( nameof ( index ) ) ; } if ( index == this . Length ) { ( ( IList ) this ) . Add ( value ) ; return ; } else { this . Length ++ ; for ( int i = this . Length - 2 ; i >= index ; i -- ) { this . SetValue ( i + 1 , this . GetValue ( i ) ) ; } ( ( IList ) this ) [ index ] = value ; } }
Inserts the value at the specified index.
Inserts the value at the specified index .
// Move the position all items at and past the index by one
index
int
Index within the list where the value should be inserted.
Index within the list where the value should be inserted .
value
object
The value to be inserted.
The value to be inserted .