DebuggerTypeProxyAttributeとは? わかりやすく解説

DebuggerTypeProxyAttribute クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

型の表示プロキシを指定します。

名前空間: System.Diagnostics
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<ComVisibleAttribute(True)> _
<AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class
 Or AttributeTargets.Struct, AllowMultiple:=True)> _
Public NotInheritable Class
 DebuggerTypeProxyAttribute
    Inherits Attribute
Dim instance As DebuggerTypeProxyAttribute
[ComVisibleAttribute(true)] 
[AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct,
 AllowMultiple=true)] 
public sealed class DebuggerTypeProxyAttribute
 : Attribute
[ComVisibleAttribute(true)] 
[AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Struct,
 AllowMultiple=true)] 
public ref class DebuggerTypeProxyAttribute
 sealed : public Attribute
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct,
 AllowMultiple=true) */ 
public final class DebuggerTypeProxyAttribute
 extends Attribute
ComVisibleAttribute(true) 
AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct,
 AllowMultiple=true) 
public final class DebuggerTypeProxyAttribute
 extends Attribute
解説解説

メモ   型自体を変更せずに、型のデバッグ ビューを根本的かつ大幅に変更する必要がある場合は、この属性を使用します。

DebuggerTypeProxyAttribute 属性を使用して型の表示プロキシを指定することにより、開発者は型のビューをカスタマイズできます。この属性はアセンブリ レベルでも使用できます。その場合は、Target プロパティでプロキシを使用する対象の型を指定します。一般に、この属性は、属性の適用対象である型で発生する、プライベートな入れ子にされた型を指定します。型ビューアをサポートする式エバリュエータは、型が表示されるときにこの属性をチェックします。属性が存在する場合、式エバリュエータは属性の適用対象の型の代わりに表示プロキシ型を使用します。

DebuggerBrowsableAttribute が存在する場合、デバッガ変数ウィンドウにはプロキシ型のパブリック メンバのみが表示されます。プライベート メンバは表示されません。データ ウィンドウの動作は、ビューの属性が拡張されても変わりません。

パフォーマンスの低下を避けるために、通常、式エバリュエータは型の表示プロキシの属性を調べません。データ ウィンドウでユーザーが型の横の正符号 (+) をクリックした場合、または DebuggerBrowsableAttribute 属性の適用によって型が展開された場合のみ調べます。したがって、表示型に属性を適用しないことをお勧めします。属性は、表示型の本体に適用可能なので、表示型の本体に適用してください。

使用例使用例

DebuggerTypeProxyAttribute を使用して、デバッガ表示プロキシとして使われる、プライベートな入れ子にされた型を指定するコード例を次に示します。このコード例は、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;
         }
      }
   }
}
継承階層継承階層
System.Object
   System.Attribute
    System.Diagnostics.DebuggerTypeProxyAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

DebuggerTypeProxyAttribute コンストラクタ (String)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

プロキシの型名を使用して、DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。

名前空間: System.Diagnostics
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim typeName As String

Dim instance As New DebuggerTypeProxyAttribute(typeName)
public DebuggerTypeProxyAttribute (
    string typeName
)
public:
DebuggerTypeProxyAttribute (
    String^ typeName
)
public DebuggerTypeProxyAttribute (
    String typeName
)
public function DebuggerTypeProxyAttribute
 (
    typeName : String
)

パラメータ

typeName

プロキシ型の型名。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DebuggerTypeProxyAttribute クラス
DebuggerTypeProxyAttribute メンバ
System.Diagnostics 名前空間

DebuggerTypeProxyAttribute コンストラクタ (Type)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

プロキシの型を使用して、DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。

名前空間: System.Diagnostics
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim type As Type

Dim instance As New DebuggerTypeProxyAttribute(type)
public DebuggerTypeProxyAttribute (
    Type type
)
public:
DebuggerTypeProxyAttribute (
    Type^ type
)
public DebuggerTypeProxyAttribute (
    Type type
)
public function DebuggerTypeProxyAttribute
 (
    type : Type
)

パラメータ

type

プロキシ型を表す Type オブジェクト。

例外例外
例外の種類条件

ArgumentNullException

type が null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

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;
         }
      }
   }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DebuggerTypeProxyAttribute クラス
DebuggerTypeProxyAttribute メンバ
System.Diagnostics 名前空間

DebuggerTypeProxyAttribute コンストラクタ

プロキシの型を使用して、DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
DebuggerTypeProxyAttribute (String) プロキシの型名を使用して、DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。
DebuggerTypeProxyAttribute (Type) プロキシの型を使用して、DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。
参照参照

関連項目

DebuggerTypeProxyAttribute クラス
DebuggerTypeProxyAttribute メンバ
System.Diagnostics 名前空間

DebuggerTypeProxyAttribute プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ ProxyTypeName プロキシ型の型名を取得します。
パブリック プロパティ Target 属性の対象の型を取得または設定します。
パブリック プロパティ TargetTypeName 対象の型の名前を取得または設定します。
パブリック プロパティ TypeId  派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。)
参照参照

関連項目

DebuggerTypeProxyAttribute クラス
System.Diagnostics 名前空間

その他の技術情報

DebuggerTypeProxy 属性の使用

DebuggerTypeProxyAttribute メソッド


パブリック メソッドパブリック メソッド

  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
参照参照

関連項目

DebuggerTypeProxyAttribute クラス
System.Diagnostics 名前空間

その他の技術情報

DebuggerTypeProxy 属性の使用

DebuggerTypeProxyAttribute メンバ

型の表示プロキシを指定します。

DebuggerTypeProxyAttribute データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド DebuggerTypeProxyAttribute オーバーロードされます。 プロキシの型を使用して、DebuggerTypeProxyAttribute クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ ProxyTypeName プロキシ型の型名を取得します。
パブリック プロパティ Target 属性の対象の型を取得または設定します。
パブリック プロパティ TargetTypeName 対象の型の名前を取得または設定します。
パブリック プロパティ TypeId  派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。)
パブリック メソッドパブリック メソッド
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
参照参照

関連項目

DebuggerTypeProxyAttribute クラス
System.Diagnostics 名前空間

その他の技術情報

DebuggerTypeProxy 属性の使用



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「DebuggerTypeProxyAttribute」の関連用語

DebuggerTypeProxyAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DebuggerTypeProxyAttributeのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS