Ejemplo n.º 1
0
        public object GetValue(IValueFactory factory, Type conversionType)
        {
            // try to find in cache
            if (isOnlyConstValues && cachedConstDictionary != null)
            {
                return(CastMap(new ConstDictionary(cachedConstDictionary, false), factory, conversionType));
            }

            // try to create instance of desired type
            string[] keys   = new string[Values.Length];
            object[] values = new object[Values.Length];
            for (int i = 0; i < Values.Length; i++)
            {
                keys[i]   = Values[i].Key;
                values[i] = Values[i].Value.GetValue(factory, typeof(object));
            }
            ConstDictionary result = new ConstDictionary(keys, values, false);

            // cache
            if (isOnlyConstValues)
            {
                cachedConstDictionary = new ConstDictionary(result);
            }
            return(CastMap(result, factory, conversionType));
        }
Ejemplo n.º 2
0
 public ConstDictionary(ConstDictionary copyFrom)
 {
     ArrKeys   = (object[])copyFrom.ArrKeys.Clone();
     ArrValues = (object[])copyFrom.ArrValues.Clone();
     isOrdered = copyFrom.isOrdered;
     if (isOrdered)
     {
         orderedKeys    = (object[])copyFrom.orderedKeys.Clone();
         orderedIndexes = (int[])copyFrom.orderedIndexes.Clone();
     }
 }
Ejemplo n.º 3
0
 public ConstDictionary(ConstDictionary copyFrom, bool isReadOnly) : this(copyFrom) {
     _IsReadOnly = isReadOnly;
 }
Ejemplo n.º 4
0
 internal ConstDictionaryEnumerator(ConstDictionary constDictionary)
 {
     dictionary = constDictionary;
 }