Exemple #1
0
 public FractalStore(params IFractal[] fractals)
 {
     foreach (var fractal in fractals)
     {
         Inner.Add(fractal);
     }
 }
 public ColorizationStore(params IFractalColorizer[] colorizers)
 {
     foreach (var colorizer in colorizers)
     {
         Inner.Add(colorizer);
     }
 }
Exemple #3
0
        public void Add(string id, AppClient client)
        {
            Guard.NotNullOrEmpty(id, nameof(id));
            Guard.NotNull(client, nameof(client));

            Inner.Add(id, client);
        }
Exemple #4
0
        public AppClients Add(string id, AppClient client)
        {
            Guard.NotNullOrEmpty(id, nameof(id));
            Guard.NotNull(client, nameof(client));

            return(new AppClients(Inner.Add(id, client)));
        }
Exemple #5
0
        public static void Main()
        {
            MultiHashDictionary <int, String, Inner> mdict = new MultiHashDictionary <int, String, Inner>();

            mdict.Add(2, "to");
            mdict.Add(2, "deux");
            mdict.Add(2, "two");
            mdict.Add(20, "tyve");
            mdict.Add(20, "tyve");
            mdict.Add(20, "twenty");
            Console.WriteLine(mdict);
            Console.WriteLine("mdict.Count is {0}", mdict.Count);
            Console.WriteLine("mdict.Count (keys) is {0}",
                              ((IDictionary <int, Inner>)mdict).Count);
            Console.WriteLine("mdict[2].Count is {0}", mdict[2].Count);
            mdict.Remove(20, "tyve");
            mdict.Remove(20, "twenty");
            Console.WriteLine(mdict);
            Console.WriteLine("mdict.Count is {0}", mdict.Count);
            Inner zwei = new Inner();

            zwei.Add("zwei");
            mdict[2]  = zwei;
            mdict[-2] = zwei;
            Console.WriteLine(mdict);
            Console.WriteLine("mdict.Count is {0}", mdict.Count);
            zwei.Add("kaksi");
            Console.WriteLine(mdict);
            Console.WriteLine("mdict.Count is {0}", mdict.Count);
            Inner empty = new Inner();

            mdict[0] = empty;
            Console.WriteLine(mdict);
            Console.WriteLine("mdict.Count is {0}", mdict.Count);
            Console.WriteLine("mdict contains key 0: {0}", mdict.Contains(0));
            mdict.Remove(-2);
            Console.WriteLine(mdict);
            Console.WriteLine("mdict.Count is {0}", mdict.Count);
            zwei.Remove("kaksi");
            Console.WriteLine(mdict);
            Console.WriteLine("mdict.Count is {0}", mdict.Count);
            zwei.Clear();
            Console.WriteLine(mdict);
            Console.WriteLine("mdict.Count is {0}", mdict.Count);
        }
 /// <summary>Adds an element with the provided key and value to the list.</summary>
 /// <param name="key">The object to use as the key of the element to add.</param>
 /// <param name="value">The object to use as the value of the element to add.</param>
 public void Add(string key, T value)
 {
     EnsureName(key, value);
     if (value != null)
     {
         Lookup.Add(key, value);
     }
     Inner.Add(value);
 }
        /// <inheritdoc cref="SortedSet{T}.Add"/>
        public Boolean Add([CanBeNull] T item)
        {
            if (!Set.Add(item !))
            {
                return(false);
            }

            Inner.Add(item);
            return(true);
        }
Exemple #8
0
 /// <summary>
 /// Adds an element with the provided key and value loader to the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="valueLoader">The value loader.</param>
 /// <remarks></remarks>
 public virtual void Add(TKey key, Lazy <TValue> valueLoader)
 {
     if (Inner.ContainsKey(key))
     {
         throw new ArgumentException("An element with the same key already exists");
     }
     else
     {
         Inner.Add(key, valueLoader);
     }
 }
Exemple #9
0
 /// <summary>
 /// Adds an item or updates it if an item with that key already exists in the collection.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 /// <param name="updator">The updator.</param>
 /// <remarks></remarks>
 public virtual void AddOrUpdate(TKey key, Lazy <TValue> value, Func <TKey, Lazy <TValue>, Lazy <TValue> > updator)
 {
     if (Inner.ContainsKey(key))
     {
         Inner[key] = updator(key, Inner[key]);
     }
     else
     {
         Inner.Add(key, value);
     }
 }
 public void Add(T item)
 {
     Lock.EnterWriteLock();
     try
     {
         Inner.Add(item);
     }
     finally
     {
         Lock.ExitWriteLock();
     }
 }
Exemple #11
0
 /// <summary>
 /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
 public virtual void Add(KeyValuePair <TKey, TValue> item)
 {
     EnsureLazyLoaderCalled();
     if (Inner.ContainsKey(item.Key))
     {
         throw new ArgumentException("An element with the same key already exists");
     }
     else
     {
         Inner.Add(item.Key, new Lazy <TValue>(() => item.Value));
     }
 }
Exemple #12
0
 /// <summary>
 /// Adds an item or updates it if an item with that key already exists in the collection.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 /// <param name="updator">The updator.</param>
 /// <remarks></remarks>
 public virtual void AddOrUpdate(TKey key, TValue value, Func <TKey, TValue, TValue> updator)
 {
     if (Inner.ContainsKey(key))
     {
         Inner[key] = updator(key, Inner[key]);
         OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, value));
     }
     else
     {
         Inner.Add(key, value);
         OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, value));
     }
 }
Exemple #13
0
 /// <inheritdoc/>
 public override void Add(TRoot item)
 {
     try
     {
         Inner.Add(item);
     }
     catch (TException ex)
     {
         if (!Handler.Invoke(ex))
         {
             throw;
         }
     }
 }
Exemple #14
0
 public T this[string name]
 {
     get { return(Inner.FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.InvariantCultureIgnoreCase))); }
     set
     {
         var index = Inner.FindIndex(i => string.Equals(i.Name, name, StringComparison.InvariantCultureIgnoreCase));
         if (index >= 0)
         {
             Inner[index] = value;
         }
         else
         {
             Inner.Add(value);
         }
     }
 }
Exemple #15
0
        public override void Add(ShellItem item)
        {
            /*
             * This is purely for the case where a user is only specifying Tabs at the highest level
             * <shell>
             * <tab></tab>
             * <tab></tab>
             * </shell>
             * */
            if (Routing.IsImplicit(item) &&
                item is TabBar
                )
            {
                int i = Count - 1;
                if (i >= 0 && this[i] is TabBar && Routing.IsImplicit(this[i]))
                {
                    (this[i] as ShellItem).Items.Add(item.Items[0]);
                    return;
                }
            }

            Inner.Add(item);
        }
Exemple #16
0
 /// <summary>
 /// 把一个初始化好的产品插入到队列INNER中;
 /// </summary>
 /// <param name="p"></param>
 private void InserInner(ProductUnit p1)
 {
     AllThick += p1.thick;
     //如果内页总厚度超过规定厚度,需要重新计算封面的尺寸;
     if (AllThick > ConstantValue.Process.ThickLast)
     {
         ReSetCover(Convert.ToInt32(p1.thick));
     }
     if (IsHeban(Cover, p1))
     {
         Cover.PageNum += p1.Size.Num;
         Cover.ReCaculation();
     }
     else
     {
         if (Inner == null)
         {
             Inner = new List <ProductUnit>();
         }
         p1.GroupId  = Inner.Count + 1;
         p1.UnitName = "画册内页" + Inner.Count.ToString();
         Inner.Add(p1);
     }
 }
Exemple #17
0
        public void Add(string id, string secret)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

            Inner.Add(id, new AppClient(id, secret, AppClientPermission.Editor));
        }
Exemple #18
0
 public void Add(T item)
 {
     Inner.Add(item);
 }
Exemple #19
0
 /// <inheritdoc/>
 public override void Add(TRoot item)
 {
     Inner.Add(item);
     Tap.AddOrUpdate(item);
 }
Exemple #20
0
 public int AddIt() => _c.Add(_a, _b);
Exemple #21
0
 public virtual void Add(T item)
 {
     Inner.Add(item);
 }
Exemple #22
0
        public AppPatterns Add(Guid id, string name, string pattern, string message)
        {
            var newPattern = new AppPattern(name, pattern, message);

            return(new AppPatterns(Inner.Add(id, newPattern)));
        }
Exemple #23
0
 public void Add(KeyValuePair <string, StringValues> item)
 {
     Inner.Add(Convert(item));
 }
Exemple #24
0
 public void Add(string key, StringValues value)
 {
     Inner.Add(key, Convert(value));
 }
 public void Add(T item)
 {
     inner = inner ?? new List <T>();
     Inner.Add(item);
 }
Exemple #26
0
        public Roles Add(string name)
        {
            var newRole = new Role(name);

            return(new Roles(Inner.Add(name, newRole)));
        }
Exemple #27
0
 public override int Add(object val)
 {
     m_owner.SetDirty();
     Tailor(val);
     return(Inner.Add(val));
 }
 /// <inheritdoc/>
 public Task AddAsync(TRoot item) => Task.Run(() => Inner.Add(item));
Exemple #29
0
        /// <summary>Adds an element with the provided key and value to the list.</summary>
        /// <param name="key">The object to use as the key of the element to add.</param>
        /// <param name="value">The object to use as the value of the element to add.</param>
        public void Add(string key, T value)
        {
            EnsureName(key, value);

            Inner.Add(value);
        }
Exemple #30
0
        public AppClients Add(string id, string secret)
        {
            Guard.NotNullOrEmpty(id, nameof(id));

            return(new AppClients(Inner.Add(id, new AppClient(id, secret, Role.Editor))));
        }