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}"); }
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())); }