Xamarin Public Jenkins f3e3aab35a Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
2016-02-22 11:00:01 -05:00

58 lines
2.2 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// EnumerableDebugView.cs
//
//
// Debugger type proxy for enumerables.
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Linq;
namespace System.Threading.Tasks.Dataflow.Internal
{
/// <summary>Debugger type proxy for an enumerable of T.</summary>
internal sealed class EnumerableDebugView<TKey, TValue>
{
/// <summary>The enumerable being visualized.</summary>
private readonly IEnumerable<KeyValuePair<TKey, TValue>> _enumerable;
/// <summary>Initializes the debug view.</summary>
/// <param name="enumerable">The enumerable being debugged.</param>
public EnumerableDebugView(IEnumerable<KeyValuePair<TKey, TValue>> enumerable)
{
Contract.Requires(enumerable != null, "Expected a non-null enumerable.");
_enumerable = enumerable;
}
/// <summary>Gets the contents of the list.</summary>
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePair<TKey, TValue>[] Items { get { return _enumerable.ToArray(); } }
}
/// <summary>Debugger type proxy for an enumerable of T.</summary>
internal sealed class EnumerableDebugView<T>
{
/// <summary>The enumerable being visualized.</summary>
private readonly IEnumerable<T> _enumerable;
/// <summary>Initializes the debug view.</summary>
/// <param name="enumerable">The enumerable being debugged.</param>
public EnumerableDebugView(IEnumerable<T> enumerable)
{
Contract.Requires(enumerable != null, "Expected a non-null enumerable.");
_enumerable = enumerable;
}
/// <summary>Gets the contents of the list.</summary>
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Items { get { return _enumerable.ToArray(); } }
}
}