BTDB.FieldHandler.EnumFieldHandler.IsCompatibleWith C# (CSharp) Method

IsCompatibleWith() public static method

public static IsCompatibleWith ( Type type ) : bool
type System.Type
return bool
        public static bool IsCompatibleWith(Type type)
        {
            if (!type.IsEnum) return false;
            var enumUnderlyingType = type.GetEnumUnderlyingType();
            return SignedFieldHandler.IsCompatibleWith(enumUnderlyingType) || UnsignedFieldHandler.IsCompatibleWith(enumUnderlyingType);
        }

Same methods

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

Usage Example

 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.EnumFieldHandler::IsCompatibleWith