Ejemplo n.º 1
0
        /// <summary>
        /// Adds the specified type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="message">The message.</param>
        public void Add(string type, string message)
        {
            if (string.IsNullOrWhiteSpace(message))
            {
                return;
            }

            IList <KeyValuePair <string, string> > messages;
            object temp;

            if (!BackingStore.TryGetValue(Key, out temp))
            {
                messages = new List <KeyValuePair <string, string> >();
                BackingStore.Add(Key, messages);
            }
            else
            {
                messages = (IList <KeyValuePair <string, string> >)temp;
            }

            var item = messages.FirstOrDefault(p => p.Key.Equals(type, StringComparison.OrdinalIgnoreCase));

            if (!string.IsNullOrWhiteSpace(item.Value))
            {
                messages.Remove(item);
            }

            messages.Add(new KeyValuePair <string, string>(type, message));

            BackingStore.Keep(Key);
        }
Ejemplo n.º 2
0
 public Word this[int index]
 {
     get
     {
         if (index >= Size || index < 0)
         {
             throw new MemoryAccessViolationException();
         }
         if (BackingStore.ContainsKey(index))
         {
             return(BackingStore[index]);
         }
         else
         {
             return(default(Word));
         }
     }
     set
     {
         if (index >= Size || index < 0)
         {
             throw new MemoryAccessViolationException();
         }
         if (BackingStore.ContainsKey(index))
         {
             BackingStore[index] = value;
         }
         else
         {
             BackingStore.Add(index, value);
         }
     }
 }
Ejemplo n.º 3
0
 public void Store(T item)
 {
     BackingStore.Add(item.Id, JsonConvert.SerializeObject(item));
 }
Ejemplo n.º 4
0
 public void Add(T item)
 {
     BackingStore.Add(item);
     SwimUp(Count);
     ++Count;
 }
Ejemplo n.º 5
0
 public void Store(T item)
 {
     BackingStore.Add(new StoredEntity(typeof(T), item));
 }