Skip to content

Commit

Permalink
fix the ImHashMap.ToString in DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
dadhi committed Jun 23, 2022
1 parent ae7a787 commit 5d5e3bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ImTools/ImTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,9 @@ public override string ToString()
// for the debug purposes we just output the first N keys in array
const int n = 50;
var count = this.Count();
var hashes = this.Enumerate().Take(n).Select(x => x.Hash).ToList();
var hashes = typeof(K) == typeof(int)
? ((ImHashMap<int, V>)(object)this).Enumerate().Take(n).Select(x => x.Hash).ToList()
: this.Enumerate().Take(n).Select(x => x.Hash).ToList();
return $"{{hashes: new int[{(count > n ? $"{n}/{count}" : "" + count)}] {{{(string.Join(", ", hashes))}}}}}";
#else
return "{}";
Expand Down

0 comments on commit 5d5e3bc

Please sign in to comment.