Files
linux-packaging-mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxy.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

35 lines
1.2 KiB
C#

// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.Internal;
namespace System.Collections.ObjectModel
{
// NOTE: This type cannot be a nested proxy of ReadOnlyDictionary due to a bug
// in the Visual Studio Debugger which causes it to ignore nested generic proxies.
internal class ReadOnlyDictionaryDebuggerProxy<TKey, TValue>
{
private readonly ReadOnlyDictionary<TKey, TValue> _dictionary;
public ReadOnlyDictionaryDebuggerProxy(ReadOnlyDictionary<TKey, TValue> dictionary)
{
Requires.NotNull(dictionary, "dictionary");
_dictionary = dictionary;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePair<TKey, TValue>[] Items
{
// NOTE: This shouldn't be cached, so that on every query of
// the current value of the underlying dictionary is respected.
get { return this._dictionary.ToArray(); }
}
}
}