Пример #1
0
        /// <summary>
        /// Construct an AlternativeMap instance with the specified default items.  This class
        /// supports a collection initializer to add alternative items during construction.
        /// </summary>
        /// <param name="defaults">A valid, non-null StaticMap collection holding the default items</param>
        /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="defaults"/>
        /// is null</exception>
        public AlternativeMap(IStaticDictionary <TKey, TValue> defaults)
        {
            if (defaults == null)
            {
                throw new ArgumentNullException("defaults");
            }

            this.defaults = defaults;
            alternatives  = new Dictionary <TKey, TValue>();
        }
Пример #2
0
        public AlternativeMap(IStaticDictionary <TKey, TValue> defaults,
                              Dictionary <TKey, TValue> alternatives)
        {
            if (defaults == null)
            {
                throw new ArgumentNullException("defaults");
            }

            if (alternatives == null)
            {
                throw new ArgumentNullException("alternatives");
            }

            this._defaults     = defaults;
            this._alternatives = new Dictionary <TKey, TValue>();

            foreach (var itm in alternatives)
            {
                this._alternatives.Add(itm.Key, itm.Value);
            }
        }
Пример #3
0
 /// <summary>
 /// Construct a PigmentMap instance given the defaults and a
 /// Dictionary of alternatives.
 /// </summary>
 /// <param name="defaults"></param>
 /// <param name="alternatives"></param>
 public PigmentMap(IStaticDictionary <PigmentType, Pigment> defaults,
                   Dictionary <PigmentType, Pigment> alternatives)
     : base(defaults, alternatives)
 {
 }
Пример #4
0
 /// <summary>
 /// Construct a PigmentMap instance given the defaults.
 /// </summary>
 /// <param name="defaults"></param>
 public PigmentMap(IStaticDictionary <PigmentType, Pigment> defaults)
     : base(defaults)
 {
 }