DebuggerBrowsableState 列舉
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供偵錯工具的顯示指示。
public enum class DebuggerBrowsableState
C#
public enum DebuggerBrowsableState
C#
[System.Runtime.InteropServices.ComVisible(true)]
public enum DebuggerBrowsableState
type DebuggerBrowsableState =
[<System.Runtime.InteropServices.ComVisible(true)>]
type DebuggerBrowsableState =
Public Enum DebuggerBrowsableState
- 繼承
- 屬性
名稱 | 值 | Description |
---|---|---|
Collapsed | 2 | 以摺疊方式顯示元素。 |
Never | 0 | 永遠不顯示元素。 |
3 | 切勿顯示根元素,如果元素是元素陣列的集合,則顯示子元素。 |
下列程式代碼範例示範如何使用 DebuggerBrowsableState 列舉,指示調試程式不要顯示屬性) 的 Keys
根 (屬性名稱,但顯示取得的數位 Keys
元素。 此程式代碼範例是提供給 類別之較大範例的 DebuggerDisplayAttribute 一部分。
[DebuggerBrowsable(DebuggerBrowsableState::RootHidden)]
property array<KeyValuePairs^>^ Keys
{
array<KeyValuePairs^>^ get()
{
array<KeyValuePairs^>^ keys = gcnew array<KeyValuePairs^>(hashtable->Count);
IEnumerator^ ie = hashtable->Keys->GetEnumerator();
int i = 0;
Object^ key;
while (ie->MoveNext())
{
key = ie->Current;
keys[i] = gcnew KeyValuePairs(hashtable, key, hashtable[key]);
i++;
}
return keys;
}
}
C#
[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
DebuggerBrowsableState 用來簡化偵錯視窗中的檢視。 使用此列舉使用 DebuggerDisplayAttribute 屬性,可能會導致偵錯視窗中更簡單且更美觀的檢視。 DebuggerBrowsableAttribute如需使用此列舉的詳細資訊,請參閱 類別。
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |