using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace 修改显示器分辨率
{
class strustapi
{
///
/// 示例
///
struct sample
{
int i;
string str;
}
///
/// 遍历结构体示例
///
void enum_strust()
{
sample sp = new sample();
foreach (FieldInfo field in typeof(sample).GetFields(BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public))
{
System.Windows.MessageBox.Show(field.Name + “=” + field.GetValue(sp).ToString());
}
}
}
}