Beispiel #1
0
 /// <summary>
 /// Creates a double attribute with given key and value
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 public virtual void SetDouble(string key, double value)
 {
     lock (attributesLock)
     {
         attributes[key] = new DoubleAttribute(value);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Retrieves a double or defaultValue if key is not found
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public virtual double GetDouble(string key, double defaultValue = 0)
        {
            DoubleAttribute attr = attributes.TryGetValue(key) as DoubleAttribute;

            return(attr == null ? defaultValue : attr.value);
        }