Ejemplo n.º 1
0
        public DictionaryConverter(Type DictionaryType, bool KeyIgnoreCase = false)
        {
            this.IsIgnoreCase = KeyIgnoreCase;

            this.DictionaryType = DictionaryType;
            KeyType             = ObjectHelper.GetDictionaryKeyType(DictionaryType);
            ValueType           = ObjectHelper.GetDictionaryValueType(DictionaryType);

            KeyLength   = ConverterHelper.GetTypeLength(KeyType);
            Valuelength = ConverterHelper.GetTypeLength(ValueType);

            GetKeyObjectBytes = ConverterHelper.GetValueToBytes(KeyType);
            GetKeyObjectValue = ConverterHelper.GetBytesToValue(KeyType);

            GetValueObjectBytes = ConverterHelper.GetValueToBytes(ValueType);
            GetValueObjectValue = ConverterHelper.GetBytesToValue(ValueType);

            if (GetKeyObjectBytes == null || GetKeyObjectValue == null)
            {
                throw new Exception(KeyType.Name + " is not yet supported.");
            }

            if (GetValueObjectBytes == null || GetValueObjectValue == null)
            {
                throw new Exception(ValueType.Name + " is not yet supported.");
            }
        }
Ejemplo n.º 2
0
        public CollectionConverter(Type CollectionType)
        {
            this.CollectionType = CollectionType;
            this.DataType       = ObjectHelper.GetEnumberableType(CollectionType);

            this.FieldLength = ConverterHelper.GetTypeLength(this.DataType);

            this.GetObjectBytes = ConverterHelper.GetValueToBytes(this.DataType);
            this.GetObjectValue = ConverterHelper.GetBytesToValue(this.DataType);

            if (this.GetObjectBytes == null || this.GetObjectValue == null)
            {
                throw new Exception(this.DataType.Name + " is not yet supported.");
            }
        }