/// <summary> /// Gets the <see cref="SwiPrologTerm"/> of the given variable name or throw an ArgumentException. /// </summary> /// <param name="name">The name of the variable</param> /// <returns>The PlTerm (value) of the variable </returns> /// <exception cref="ArgumentException">Is thrown if the name is not the name of a variable.</exception> public SwiPrologTerm this[string name] { get { SwiPrologQueryVariable v = _vars.Find(n1 => n1.Name == name); if (v == null) { throw new ArgumentException("'" + name + "' is not a variable", "name"); } return(v.Value); } }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <returns></returns> public bool TryGetValue(string key, out object value) { SwiPrologQueryVariable v = _vars.Find(n1 => n1.Name == key); if (v == null) { value = null; return(false); } value = v.Value; return(true); }
object IDictionary <string, object> .this[string name] { get { SwiPrologQueryVariable v = _vars.Find(n1 => n1.Name == name); if (v == null) { throw new ArgumentException("'" + name + "' is not a variable", "name"); } return(v.Value); } set { throw new InvalidOperationException(); } }
internal void Add(SwiPrologQueryVariable var) { _vars.Add(var); }