{
return null;
}
- EnsureObjectsTable();
return _objectsTable[key];
}
set
{
throw new NotSupportedException(SR.OrderedDictionary_ReadOnly);
}
- EnsureObjectsTable();
- EnsureObjectsArray();
- _objectsTable.Clear();
- _objectsArray.Clear();
+ if (_objectsTable != null)
+ {
+ _objectsTable.Clear();
+ }
+ if (_objectsArray != null)
+ {
+ _objectsArray.Clear();
+ }
}
/// <devdoc>
/// </devdoc>
public bool Contains(object key)
{
+ if (key == null)
+ {
+ throw new ArgumentNullException(nameof(key));
+ }
if (_objectsTable == null)
{
return false;
info.AddValue(InitCapacityName, _initialCapacity);
object[] serArray = new object[Count];
+ EnsureObjectsArray();
_objectsArray.CopyTo(serArray);
info.AddValue(ArrayListName, serArray);
}