示例#1
0
 public static string Get(T value)
 {
     if (!map.TryGetValue(value, out string str))
     {
         str = value.ToString();
         map.Add(value, str);
     }
     return(str);
 }
示例#2
0
 static AttributedTypeCache()
 {
     foreach (var type in Meta.kumaAsms.AllTypes())
     {
         foreach (var attr in type.GetCustomAttributes())
         {
             if (!catalog.TryGetValue(attr.GetType(), out UnorderedSet <TypeKey> types))
             {
                 types = new UnorderedSet <TypeKey>(4);
                 catalog.Add(attr.GetType(), types);
             }
             types.AddIfNone(type);
         }
     }
 }
示例#3
0
 public bool TryGetKey(TValue value, out TKey key)
 {
     return(valueToKey.TryGetValue(value, out key));
 }
示例#4
0
 public bool TryGetValue(TKey key, out TValue value)
 {
     return(keyToValue.TryGetValue(key, out value));
 }