void IList.Insert(int index, object value) { ReadOnlyCollectionBuilder <T> .ValidateNullValue(value, "value"); try { this.Insert(index, (T)value); } catch (InvalidCastException) { ReadOnlyCollectionBuilder <T> .ThrowInvalidTypeException(value, "value"); } }
int IList.Add(object value) { ReadOnlyCollectionBuilder <T> .ValidateNullValue(value, "value"); try { this.Add((T)value); } catch (InvalidCastException) { ReadOnlyCollectionBuilder <T> .ThrowInvalidTypeException(value, "value"); } return(this.Count - 1); }
object IList.this[int index] { get { return(this[index]); } set { ReadOnlyCollectionBuilder <T> .ValidateNullValue(value, "value"); try { this[index] = (T)value; } catch (InvalidCastException) { ReadOnlyCollectionBuilder <T> .ThrowInvalidTypeException(value, "value"); } } }