DebuggerBrowsableState 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供调试器的显示说明。
public enum class DebuggerBrowsableState
public enum DebuggerBrowsableState
[System.Runtime.InteropServices.ComVisible(true)]
public enum DebuggerBrowsableState
type DebuggerBrowsableState =
[<System.Runtime.InteropServices.ComVisible(true)>]
type DebuggerBrowsableState =
Public Enum DebuggerBrowsableState
- 继承
- 属性
字段
| 名称 | 值 | 说明 |
|---|---|---|
| Never | 0 | 从不显示元素。 |
| Collapsed | 2 | 将元素显示为折叠。 |
| 3 | 不显示根元素;如果元素是项的集合或数组,则显示子元素。 |
示例
下面的代码示例演示如何使用 DebuggerBrowsableState 枚举来指示调试器不显示属性的 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
注解
DebuggerBrowsableState 用于简化调试窗口中的视图。 DebuggerDisplayAttribute使用此枚举的属性可能会导致调试窗口中更简单、更令人高兴的视图。 DebuggerBrowsableAttribute有关使用此枚举的信息,请参阅该类。