Added DebuggerDisplay to ConcurrentDictionaryWrapper

This commit is contained in:
RogueException
2016-06-28 17:54:41 -03:00
parent 6d6af08815
commit 4a934ee16c

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace Discord.Extensions
@@ -11,7 +12,8 @@ namespace Discord.Extensions
public static IReadOnlyCollection<TValue> ToReadOnlyCollection<TValue, TSource>(this IEnumerable<TValue> query, IReadOnlyCollection<TSource> source)
=> new ConcurrentDictionaryWrapper<TValue, TSource>(source, query);
}
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
internal struct ConcurrentDictionaryWrapper<TValue, TSource> : IReadOnlyCollection<TValue>
{
private readonly IReadOnlyCollection<TSource> _source;
@@ -26,6 +28,8 @@ namespace Discord.Extensions
_query = query;
}
private string DebuggerDisplay => $"Count = {Count}";
public IEnumerator<TValue> GetEnumerator() => _query.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => _query.GetEnumerator();
}