예제 #1
0
 /// <summary>
 /// Creates a long attribute with given key and value
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 public virtual void SetLong(string key, long value)
 {
     lock (attributesLock)
     {
         attributes[key] = new LongAttribute(value);
     }
 }
예제 #2
0
        /// <summary>
        /// Retrieves a long or default value if key is not found
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public virtual long GetLong(string key, long defaultValue = 0)
        {
            LongAttribute attr = (LongAttribute)attributes.TryGetValue(key);

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