示例#1
0
        public static string Invoke(string id)
        {
            if (IdCounterDictionary.TryGetValue(id, out var counter) == false)
            {
                IdCounterDictionary[id] = counter = new DebugCounter(id);
            }

            counter.Count++;

            return($"{counter.Id}: {counter.Count}");
        }
示例#2
0
        public static DebugId <T> Create(string name = null)
        {
            var type = typeof(T);

            if (IdCounterDictionary.TryGetValue(type, out var id))
            {
                IdCounterDictionary[type] = id + 1;
            }
            else
            {
                IdCounterDictionary[type] = 1;
            }

            return(new DebugId <T>(id, name ?? typeof(T).ToString()));
        }