DebuggerBrowsableAttribute(DebuggerBrowsableState) 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 DebuggerBrowsableAttribute 類別的新執行個體。
public:
DebuggerBrowsableAttribute(System::Diagnostics::DebuggerBrowsableState state);
public DebuggerBrowsableAttribute(System.Diagnostics.DebuggerBrowsableState state);
new System.Diagnostics.DebuggerBrowsableAttribute : System.Diagnostics.DebuggerBrowsableState -> System.Diagnostics.DebuggerBrowsableAttribute
Public Sub New (state As DebuggerBrowsableState)
參數
- state
- DebuggerBrowsableState
其中一個 DebuggerBrowsableState 值是指定如何顯示該成員的。
例外狀況
state 不是其中 DebuggerBrowsableState 的價值觀之一。
範例
以下程式碼範例展示了如何使用 DebuggerBrowsableAttribute 屬性指示除錯器不顯示屬性的 Keys 根(屬性名稱),而是顯示 取得的陣列 Keys 元素。 此程式碼範例是本類別更大範例 DebuggerDisplayAttribute 的一部分。
[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;
}
}
<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
備註
此屬性僅適用於屬性與欄位。