예제 #1
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="ConstantDictionary{T}"/> class from the
        /// other <see cref="ConstantDictionary{T}"/> instance.</summary>
        /// <param name="dictionary">
        /// <see cref="ConstantDictionary{T}"/> instance.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="dictionary"/> is null.</exception>
        public ConstantDictionary(ConstantDictionary <T> dictionary)
        {
            if (dictionary == null)
            {
                throw new ArgumentNullException("dictionary");
            }

            this.namesList  = new List <string>(dictionary.namesList);
            this.valuesList = new List <T>(dictionary.valuesList);
        }
예제 #2
0
        public ConstantsDebugView(ConstantDictionary <T> list)
        {
            this.items = new ViewItem[list.Count];
            int i = 0;

            foreach (var item in list)
            {
                this.items[i].Name  = item.Key;
                this.items[i].Value = item.Value;
                i++;
            }
        }
예제 #3
0
        /// <summary>
        /// Set the custom dictionary as built-ins imports for the
        /// ConstantDictionary of type <typeparamref name="T"/>.</summary>
        /// <param name="dictionary">Dictionary to set.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="dictionary"/> is null.</exception>
        public static void SetBuiltIns(ConstantDictionary <T> dictionary)
        {
            if (dictionary == null)
            {
                throw new ArgumentNullException("dictionary");
            }

            lock (SyncRoot)
            {
                BuiltIns.Clear();
                BuiltIns.AddRange(dictionary);
            }
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CalcContext{T}"/>
 /// class that is contains empty expression context.</summary>
 /// <overloads>Initializes a new instance
 /// of the <see cref="CalcContext{T}"/> class.</overloads>
 public CalcContext()
 {
     this.arguments = new ArgumentCollection();
     this.constants = new ConstantDictionary <T>();
     this.functions = new FunctionCollection <T>();
 }