DebuggerDisplayAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Enum Or AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Delegate, AllowMultiple:=True)> _ <ComVisibleAttribute(True)> _ Public NotInheritable Class DebuggerDisplayAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Delegate, AllowMultiple=true)] [ComVisibleAttribute(true)] public sealed class DebuggerDisplayAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Enum|AttributeTargets::Property|AttributeTargets::Field|AttributeTargets::Delegate, AllowMultiple=true)] [ComVisibleAttribute(true)] public ref class DebuggerDisplayAttribute sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Delegate, AllowMultiple=true) */ /** @attribute ComVisibleAttribute(true) */ public final class DebuggerDisplayAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Delegate, AllowMultiple=true) ComVisibleAttribute(true) public final class DebuggerDisplayAttribute extends Attribute

DebuggerDisplayAttribute コンストラクタは、1 つの引数 (型のインスタンスの値列に表示される文字列) を持っています。この文字列には、中かっこ ({ と }) が含まれます。中かっこに囲まれたテキストは、フィールド、プロパティ、またはメソッドの名前と見なされます。たとえば、次の C# コードでは、正符号 (+) を選択して MyHashtable のインスタンスのデバッガ表示を展開すると、"Count = 4" が表示されます。
式で参照されるプロパティに適用する属性は処理されません。コンパイラによっては、対象の型の現在のインスタンスに対して、この参照への暗黙的なアクセスだけを持つ、一般的な式を使用できる場合があります。式には、エイリアス、ローカル、またはポインタへのアクセスを含めないという制限があります。
Target プロパティは、属性がアセンブリ レベルで使用される場合の対象の型を指定します。Name プロパティには、コンストラクタで使用される文字列のような文字列を中かっこで囲んだ式で含めることができます。型をデータ ウィンドウで表示しない場合は、Type プロパティを空白にすることができます。
![]() |
---|
この属性の Visual Studio 2005 での使用の詳細については、「DebuggerDisplay 属性の使用」を参照してください。

次のコード例を Visual Studio 2005 で参照して、DebuggerDisplayAttribute を適用した結果を確認できます。
using System; using System.Collections; using System.Diagnostics; using System.Reflection; //[assembly: DebuggerTypeProxy("MyHashtable.HashtableDebugView" ,TargetTypeName="MyHashtable")] class DebugViewTest { // The following constant will appear in the debug window for DebugViewTest. const string TabString = " "; // The following DebuggerBrowsableAttribute prevents the property following it // from appearing in the debug window for the class. [DebuggerBrowsable(DebuggerBrowsableState.Never)] public static string y = "Test String"; static void Main(string[] args) { MyHashtable myHashTable = new MyHashtable(); myHashTable.Add("one", 1); myHashTable.Add("two", 2); Console.WriteLine(myHashTable.ToString()); Console.WriteLine("In Main."); } } [DebuggerDisplay("{value}", Name = "{key}")] internal class KeyValuePairs { private IDictionary dictionary; private object key; private object value; public KeyValuePairs(IDictionary dictionary, object key, object value) { this.value = value; this.key = key; this.dictionary = dictionary; } } [DebuggerDisplay("Count = {Count}")] [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.Attribute
System.Diagnostics.DebuggerDisplayAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DebuggerDisplayAttribute コンストラクタ
アセンブリ: mscorlib (mscorlib.dll 内)


value パラメータには中かっこ ({ と }) を含めることができます。中かっこに囲まれたテキストは、フィールド、プロパティ、またはメソッドの名前と見なされます。たとえば、次の C# コードでは、正符号 (+) を選択して MyTable のインスタンスのデバッガ表示を展開すると、"Count = 4" が表示されます。
[C#]
式で参照されるプロパティに適用する属性は処理されません。コンパイラによっては、対象の型の現在のインスタンスに対して、この参照への暗黙的なアクセスだけを持つ、一般的な式を使用できる場合があります。式には、エイリアス、ローカル、またはポインタへのアクセスを含めないという制限があります。

次のコード例では、正符号 (+) を選択して MyHashtable のインスタンスのデバッガ表示を展開すると、継承された Hashtable クラスからの Count プロパティの値が表示されます。結果を確認するには、DebuggerDisplayAttribute クラスのトピックで取り上げているコード例全体を実行する必要があります。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DebuggerDisplayAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | Name | デバッガ変数ウィンドウ内に表示する名前を取得または設定します。 |
![]() | Target | 属性の対象の型を取得または設定します。 |
![]() | TargetTypeName | 属性の対象の型名を取得または設定します。 |
![]() | Type | デバッガ変数ウィンドウ内の型列に表示する文字列を取得または設定します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |
![]() | Value | デバッガ変数ウィンドウの値列に表示する文字列を取得します。 |

DebuggerDisplayAttribute メソッド

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

DebuggerDisplayAttribute メンバ
デバッガ変数ウィンドウ内でクラスまたはフィールドを表示する方法を決定します。
DebuggerDisplayAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Name | デバッガ変数ウィンドウ内に表示する名前を取得または設定します。 |
![]() | Target | 属性の対象の型を取得または設定します。 |
![]() | TargetTypeName | 属性の対象の型名を取得または設定します。 |
![]() | Type | デバッガ変数ウィンドウ内の型列に表示する文字列を取得または設定します。 |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |
![]() | Value | デバッガ変数ウィンドウの値列に表示する文字列を取得します。 |

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

Weblioに収録されているすべての辞書からDebuggerDisplayAttributeを検索する場合は、下記のリンクをクリックしてください。

- DebuggerDisplayAttributeのページへのリンク