src/GenFx.Components/Lists/ListEntityBase.OfT.cs
/// <summary>
/// Sets the list element at the specified index.
/// </summary>
/// <param name="index">The zero-based index of the list element to set.</param>
/// <param name="value">The value to set at the index.</param>
Sets the list element at the specified index.
Sets the list element at the specified index .
public sealed override void SetValue(int index, object? value)
        {
            if (value == null && (Nullable.GetUnderlyingType(typeof(TItem)) != null || typeof(TItem).IsValueType))
            {
                throw new ArgumentNullException(nameof(value));
            }
            if (value != null && !(value is TItem))
            {
                throw new ArgumentException(StringUtil.GetFormattedString(Resources.ErrorMsg_ListEntityBase_InvalidItemType, value.GetType(), typeof(TItem)),
                    nameof(value));
            }
#pragma warning disable CS8601 
            this[index] = (TItem)value;
#pragma warning restore CS8601 
        }
public sealed override void SetValue ( int index , object ? value ) { if ( value == null && ( Nullable . GetUnderlyingType ( typeof ( TItem ) ) != null || typeof ( TItem ) . IsValueType ) ) { throw new ArgumentNullException ( nameof ( value ) ) ; } if ( value != null && ! ( value is TItem ) ) { throw new ArgumentException ( StringUtil . GetFormattedString ( Resources . ErrorMsg_ListEntityBase_InvalidItemType , value . GetType ( ) , typeof ( TItem ) ) , nameof ( value ) ) ; } pragma warning disable CS8601 this [ index ] = ( TItem ) value ; pragma warning restore CS8601 }
Sets the list element at the specified index.
Sets the list element at the specified index .
// Possible null reference assignment. // Possible null reference assignment.
index
int
The zero-based index of the list element to set.
The zero - based index of the list element to set .
value
object?
The value to set at the index.
The value to set at the index .