Пример #1
0
 public T this[ulong hash]
 {
     get
     {
         foreach (var pair in this)
         {
             if (pair.Key == hash)
             {
                 return(pair.Value);
             }
         }
         throw new KeyNotFoundException($"The given key '{Hash40Util.FormatToString(hash)}' was not present in the dictionary.");
     }
     set
     {
         foreach (var pair in this)
         {
             if (pair.Key == hash)
             {
                 pair.Value = value;
                 return;
             }
         }
         throw new KeyNotFoundException($"The given key '{Hash40Util.FormatToString(hash)}' was not present in the dictionary.");
     }
 }
Пример #2
0
 public string ToString(IDictionary <ulong, string> labels)
 {
     if (TypeKey == ParamType.hash40)
     {
         return(Hash40Util.FormatToString((ulong)Value, labels));
     }
     return(Value.ToString());
 }
Пример #3
0
        public IEnumerable <T> IndexEnumerable(ulong hash)
        {
            int count = 0;

            foreach (var pair in this)
            {
                if (pair.Key == hash)
                {
                    count++;
                    yield return(pair.Value);
                }
            }
            if (count == 0)
            {
                throw new KeyNotFoundException($"The given key '{Hash40Util.FormatToString(hash)}' was not present in the dictionary.");
            }
        }