/// <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);
        }
Exemple #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);
         }
     }
 }
 public void Store(T item)
 {
     BackingStore.Add(item.Id, JsonConvert.SerializeObject(item));
 }
 public void Add(T item)
 {
     BackingStore.Add(item);
     SwimUp(Count);
     ++Count;
 }
Exemple #5
0
 public void Store(T item)
 {
     BackingStore.Add(new StoredEntity(typeof(T), item));
 }