/// <summary> /// Indicates if this is a valid type combination /// </summary> /// <param name="t"></param> /// <returns></returns> internal bool IsSupportedKeyValuePairDictionary(Type t) { if (t.IsGenericType) { var types = t.GetGenericArguments(); var key = types[0]; var value = types[1]; var validKey = (IsValueTypeOrStringOrTypeNotStruct(key) || typeof(IStateObject).IsAssignableFrom(key)); var validValue = (IsValueTypeOrStringOrType(value) || typeof(IStateObject).IsAssignableFrom(value) || SurrogatesDirectory.IsSurrogateRegistered(value)); if (!validValue && value.IsGenericType) { var genericValueType = value.GetGenericTypeDefinition(); if (genericValueType == typeof(IList <>)) { validValue = TypeCacheUtils.IsSupportedGenericTypeForList(value); } else if (genericValueType == typeof(IDictionary <,>)) { validValue = IsSupportedKeyValuePairDictionary(value); } } return(validKey && validValue); } throw new ArgumentException("This method should only be called for generic types"); }