BTDB.FieldHandler.DictionaryFieldHandler.IsCompatibleWith C# (CSharp) Метод

IsCompatibleWith() публичный статический Метод

public static IsCompatibleWith ( Type type ) : bool
type System.Type
Результат bool
        public static bool IsCompatibleWith(Type type)
        {
            if (!type.IsGenericType) return false;
            return type.GetGenericTypeDefinition() == typeof(IDictionary<,>) || type.GetGenericTypeDefinition() == typeof(Dictionary<,>);
        }

Same methods

DictionaryFieldHandler::IsCompatibleWith ( Type type, FieldHandlerOptions options ) : bool

Usage Example

Пример #1
0
 public virtual IFieldHandler CreateFromType(Type type, FieldHandlerOptions options)
 {
     if (EnumFieldHandler.IsCompatibleWith(type))
     {
         return(new EnumFieldHandler(type));
     }
     foreach (var fieldHandler in BasicSerializersFactory.FieldHandlers)
     {
         if (fieldHandler.IsCompatibleWith(type, options))
         {
             return(fieldHandler);
         }
     }
     if (ListFieldHandler.IsCompatibleWith(type))
     {
         return(new ListFieldHandler(_provider.FieldHandlerFactory, _provider.TypeConvertorGenerator, type));
     }
     if (DictionaryFieldHandler.IsCompatibleWith(type))
     {
         return(new DictionaryFieldHandler(_provider.FieldHandlerFactory, _provider.TypeConvertorGenerator, type));
     }
     if (NullableFieldHandler.IsCompatibleWith(type))
     {
         return(new NullableFieldHandler(_provider.FieldHandlerFactory, _provider.TypeConvertorGenerator, type));
     }
     return(null);
 }
All Usage Examples Of BTDB.FieldHandler.DictionaryFieldHandler::IsCompatibleWith