public bool TryCreate(Type type, out ITypeMarshaler typeMarshaler)
        {
            if (!IsUniqueSettingsCollection(type) || type.IsAbstract)
            {
                typeMarshaler = null;
                return(false);
            }
            Type           elementType      = GetSettingsType(type);
            ITypeMarshaler elementMarshaler = MarshalingManager.GetMarshaler(elementType);

            typeMarshaler = new UniqueSettingsCollectionMarhaler(type, elementMarshaler);
            return(true);
        }
        public bool TryCreate(Type type, out ITypeMarshaler typeMarshaler)
        {
            if (!type.IsEnum)
            {
                typeMarshaler = null;
                return(false);
            }
            Type           underlyingType      = Enum.GetUnderlyingType(type);
            ITypeMarshaler underlyingMarshaler = MarshalingManager.GetMarshaler(underlyingType);

            if (underlyingMarshaler == null)
            {
                typeMarshaler = null;
                return(false);
            }
            typeMarshaler = new EnumMarshaler(type, underlyingMarshaler);
            return(true);
        }
예제 #3
0
        public bool TryCreate(Type type, out ITypeMarshaler typeMarshaler)
        {
            if (!IsList(type))
            {
                typeMarshaler = null;
                return(false);
            }
            Type           elementType      = type.GetProperty("Item").PropertyType;
            ITypeMarshaler elementMarshaler = MarshalingManager.GetMarshaler(elementType);

            if (elementMarshaler == null)
            {
                typeMarshaler = null;
                return(false);
            }
            typeMarshaler = new ListMarshaler(type, elementMarshaler);
            return(true);
        }
예제 #4
0
        public bool TryCreate(Type type, out ITypeMarshaler typeMarshaler)
        {
            if (!type.IsArray)
            {
                typeMarshaler = null;
                return(false);
            }
            Type           elementType      = type.GetElementType();
            ITypeMarshaler elementMarshaler = MarshalingManager.GetMarshaler(elementType);

            if (elementMarshaler == null)
            {
                typeMarshaler = null;
                return(false);
            }
            typeMarshaler = new ArrayMarshaler(type, elementMarshaler);
            return(true);
        }