📄 26.10.txt
字号:
Listing 26.10 Enumerating Device Properties
private void DeviceInformationForm_Load(object sender, System.EventArgs e)
{
if( !Page.IsPostBack )
{
StringBuilder sb = new StringBuilder();
// for each public property
foreach( PropertyInfo prop in
Device.GetType().GetProperties(
BindingFlags.Instance | BindingFlags.Public) )
{
// only retrieve boolean properties
if( prop.PropertyType != typeof(bool))
continue;
// print out property name and current value
if( prop.GetValue(Device, null) != null )
tvDeviceInfo.Text += “<b>” +
prop.Name + “</b> = <em>” +
prop.GetValue( Device, null ).ToString()+ “</em><br>”;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -