Example #1
0
        public void Remove(K _key, V _ValueToRemove)
        {
            List <V> tempValues;

            if (map.TryGetValue(_key, out tempValues))
            {
                if (tempValues.Remove(_ValueToRemove))
                {
                    RemoveValue?.Invoke(_ValueToRemove);

                    if (tempValues.Count == 0)
                    {
                        RemoveKey?.Invoke(_key);
                        map.Remove(_key);
                    }
                }
                else
                {
                    Console.WriteLine("The value " + _ValueToRemove + " could not be found in association with " + _key);
                }
            }
            else
            {
                Console.WriteLine("The key " + _key + " could not be found");
            }
        }
Example #2
0
 void RemoveKeyFromSession(RemoveValue message)
 {
     IncrementChangeCounter();
     _storage.Remove(message.DocumentType.ToString(), message.Key);
 }
Example #3
0
 /// <summary>
 /// Extends Remove action with the ability to ignore case.
 /// </summary>
 public static RemoveValueIgnoringCase IgnoringCase(this RemoveValue source)
 {
     return(new RemoveValueIgnoringCase(source));
 }
Example #4
0
 /// <summary>
 /// Extends Remove action with the ability to change starting point.
 /// </summary>
 /// <param name="position">
 /// Position in source string to start from. Beginning or End values could be used
 /// </param>
 /// <exception cref="ArgumentOutOfRangeException">Thrown when StartOf or EndOf position value is used</exception>
 public static RemoveValueFrom From(this RemoveValue source, The position)
 {
     return(new RemoveValueFrom(source, position));
 }
Example #5
0
 public static RemoveValueAfterOccurrence After(this RemoveValue source, int occurrence, string marker)
 {
     return(new RemoveValueAfterOccurrence(source, occurrence, marker));
 }
Example #6
0
 public static RemoveValueAfter After(this RemoveValue source, string marker)
 {
     return(new RemoveValueAfter(source, marker));
 }
Example #7
0
 public static RemoveValueBeforeOccurrence Before(this RemoveValue source, int occurrence, string marker)
 {
     return(new RemoveValueBeforeOccurrence(source, occurrence, marker));
 }
Example #8
0
 public static RemoveValueBefore Before(this RemoveValue source, string marker)
 {
     return(new RemoveValueBefore(source, marker));
 }