void System.Collections.IList.Insert(int index, Object item) { ThrowHelper.IfNullAndNullsAreIllegalThenThrow <T>(item, ExceptionArgument.item); try { Insert(index, (T)item); } catch (InvalidCastException) { ThrowHelper.ThrowWrongValueTypeArgumentException(item, typeof(T)); } }
int System.Collections.IList.Add(Object item) { ThrowHelper.IfNullAndNullsAreIllegalThenThrow <T>(item, ExceptionArgument.item); try { Add((T)item); } catch (InvalidCastException) { ThrowHelper.ThrowWrongValueTypeArgumentException(item, typeof(T)); } return(Count - 1); }
Object System.Collections.IList.this[int index] { get => this[index]; set { ThrowHelper.IfNullAndNullsAreIllegalThenThrow <T>(value, ExceptionArgument.value); try { this[index] = (T)value; } catch (InvalidCastException) { ThrowHelper.ThrowWrongValueTypeArgumentException(value, typeof(T)); } } }