⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 26.10.txt

📁 《Microsoft Visual C# .NET 2003开发技巧大全》源代码
💻 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 + -