Exemplo n.º 1
0
 void IDictionary <Symbol, ValueT> .Add(Symbol key, ValueT value)
 {
     if (this.HasTag(key))
     {
         CheckParam.ThrowBadArgument(nameof(key), "The key '{0}' already exists in the IDictionary", key.Name);
     }
     this.SetTag(key, value);
 }
Exemplo n.º 2
0
 public static int ThrowIfStartOrCountAreBelowZeroAndLimitCountIfNecessary(int start, int count, int outerCount)
 {
     if (start < 0)
     {
         CheckParam.ThrowBadArgument("The start index was below zero.");
     }
     if (count < 0)
     {
         CheckParam.ThrowBadArgument("The count was below zero.");
     }
     return(count <= outerCount - start ? count : System.Math.Max(outerCount - start, 0));
 }
Exemplo n.º 3
0
 void ICollection <KeyValuePair <Symbol, ValueT> > .CopyTo(KeyValuePair <Symbol, ValueT>[] array, int arrayIndex)
 {
     if (((IDictionary <Symbol, ValueT>) this).Count > array.Length - arrayIndex)
     {
         CheckParam.ThrowBadArgument("Insufficient space in supplied array");
     }
     if (_attrs == null)
     {
         ((ICollection <KeyValuePair <Symbol, ValueT> >)_attrs).CopyTo(array, arrayIndex);
     }
     if (_cachedAttrKey != null)
     {
         array[arrayIndex] = new KeyValuePair <Symbol, ValueT>(_cachedAttrKey, _cachedAttrValue);
     }
 }