/// <summary>
 /// Checks whether the value would pass the generic type restriction set by the collection, if any.
 /// </summary>
 /// <param name="value">The value to be checked for compatibility with the collection.</param>
 /// <returns>True if the value can be added to the collection, false otherwise.</returns>
 public bool PassesElementTypeRestriction(object value)
 {
     return(isTypeConstrained ? SerializationUtilities.PassesElementTypeRestriction(value, elementType) : true);
 }
 public bool PassesKeyTypeRestriction(object key)
 {
     return(isKeyTypeConstrained ? SerializationUtilities.PassesElementTypeRestriction(key, keyType) : true);
 }