Ejemplo n.º 1
0
        public double GetReplacement(string token)
        {
            VariableReplacement replacement = null;

            if (_replacements.TryGetValue(token, out replacement))
            {
                return(replacement.Value);
            }

            throw new KeyNotFoundException($"Token '{token}' not provided.");
        }
Ejemplo n.º 2
0
 public void Add(VariableReplacement replacement)
 {
     try
     {
         _replacements.Add(replacement.Token, replacement);
     }
     catch (ArgumentException ex)
     {
         throw new ArgumentException($"Token '{replacement.Token}' already exists in the collection.", ex);
     }
 }