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)); }
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(); } }
public ConstDictionary(ConstDictionary copyFrom, bool isReadOnly) : this(copyFrom) { _IsReadOnly = isReadOnly; }
internal ConstDictionaryEnumerator(ConstDictionary constDictionary) { dictionary = constDictionary; }