DebuggerDisplayAttribute.Name プロパティ

定義

デバッガー変数ウィンドウ内に表示する名前を取得または設定します。

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string Name { get; set; }
public string? Name { get; set; }
member this.Name : string with get, set
Public Property Name As String

プロパティ値

デバッガー変数ウィンドウに表示する名前。

次のコード例では、デバッガー変数ウィンドウに各キーの名前と値を表示します。 属性が適用されていない場合、インデックスと値の型が表示されます (例: "[0] {KeyValuePairs}")。 属性が適用されると、キーとその値の名前が表示されます (たとえば、最初のキーが "one" で、その値が 1 の場合、表示は "1" になります)。 このコード例は、DebuggerDisplayAttribute クラスのために提供されている大規模な例の一部です。

[DebuggerDisplay("{value}", Name = "{key}")]
ref class KeyValuePairs
{
private:
    IDictionary^ dictionary;
    Object^ key;
    Object^ value;

public:
    KeyValuePairs(IDictionary^ dictionary, Object^ key, Object^ value)
    {
        this->value = value;
        this->key = key;
        this->dictionary = dictionary;
    }
};
[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("{value}", Name := "{key}")>  _
Friend Class KeyValuePairs
    Private dictionary As IDictionary
    Private key As Object
    Private value As Object
    
    
    Public Sub New(ByVal dictionary As IDictionary, ByVal key As Object, ByVal value As Object) 
        Me.value = value
        Me.key = key
        Me.dictionary = dictionary

    End Sub
End Class

注釈

値には中かっこ ({ および }) を含めることができます。 中かっこのペア内のテキストは、フィールド、プロパティ、またはメソッドの名前として評価されます。

適用対象