DebuggerTypeProxyAttribute コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
プロキシの型を使用して、 DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| DebuggerTypeProxyAttribute(String) |
プロキシの型名を使用して、 DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。 |
| DebuggerTypeProxyAttribute(Type) |
プロキシの型を使用して、 DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。 |
DebuggerTypeProxyAttribute(String)
プロキシの型名を使用して、 DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。
public:
DebuggerTypeProxyAttribute(System::String ^ typeName);
public DebuggerTypeProxyAttribute(string typeName);
new System.Diagnostics.DebuggerTypeProxyAttribute : string -> System.Diagnostics.DebuggerTypeProxyAttribute
Public Sub New (typeName As String)
パラメーター
- typeName
- String
プロキシ型の型名。
注釈
デバッガーは、ターゲット型の変数を表示する必要があるたびに、型プロキシ クラスの新しいインスタンスを作成します。 これはパフォーマンスに影響を与える可能性があります。 その結果、コンストラクターで必要以上の作業を行わないでください。
適用対象
DebuggerTypeProxyAttribute(Type)
プロキシの型を使用して、 DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。
public:
DebuggerTypeProxyAttribute(Type ^ type);
public DebuggerTypeProxyAttribute(Type type);
new System.Diagnostics.DebuggerTypeProxyAttribute : Type -> System.Diagnostics.DebuggerTypeProxyAttribute
Public Sub New (type As Type)
パラメーター
- type
- Type
プロキシの種類。
例外
type は nullです。
例
次のコード例は、 DebuggerTypeProxyAttribute(Type) コンストラクターを使用してデバッガー表示プロキシを指定する方法を示しています。 このコード例は、 DebuggerDisplayAttribute クラスに提供されるより大きな例の一部です。
[DebuggerTypeProxy(typeof(HashtableDebugView))]
class MyHashtable : Hashtable
{
private const string TestString = "This should not appear in the debug window.";
internal class HashtableDebugView
{
private Hashtable hashtable;
public const string TestString = "This should appear in the debug window.";
public HashtableDebugView(Hashtable hashtable)
{
this.hashtable = hashtable;
}
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePairs[] Keys
{
get
{
KeyValuePairs[] keys = new KeyValuePairs[hashtable.Count];
int i = 0;
foreach(object key in hashtable.Keys)
{
keys[i] = new KeyValuePairs(hashtable, key, hashtable[key]);
i++;
}
return keys;
}
}
}
}
<DebuggerDisplay("Count = {Count}"), DebuggerTypeProxy(GetType(MyHashtable.HashtableDebugView))> _
Class MyHashtable
Inherits Hashtable
Private Const TestString As String = "This should not appear in the debug window."
Friend Class HashtableDebugView
Private hashtable As Hashtable
Public Shared TestString As String = "This should appear in the debug window."
Public Sub New(ByVal hashtable As Hashtable)
Me.hashtable = hashtable
End Sub
<DebuggerBrowsable(DebuggerBrowsableState.RootHidden)> _
ReadOnly Property Keys as KeyValuePairs()
Get
Dim nkeys(hashtable.Count) as KeyValuePairs
Dim i as Integer = 0
For Each key As Object In hashtable.Keys
nkeys(i) = New KeyValuePairs(hashtable, key, hashtable(key))
i = i + 1
Next
Return nkeys
End Get
End Property
End Class
End Class
注釈
デバッガーは、ターゲット型の変数を表示する必要があるたびに、型プロキシ クラスの新しいインスタンスを作成します。 これはパフォーマンスに影響を与える可能性があります。 その結果、コンストラクターで必要以上の作業を行わないでください。