110,571
社区成员
发帖
与我相关
我的任务
分享
private void btnInt_Click(object sender, EventArgs e)
{
DateTime dt = new DateTime(2014, 4, 28);
Type ts = dt.GetType();
listBox1.Items.Clear();
PropertyInfo[] properties = ts.GetProperties();
listBox1.Items.Add(dt.ToShortDateString());
foreach (var property in properties)
{
if (property.PropertyType == typeof(int))
property.SetValue(dt,2, null);
}
listBox1.Items.Add(dt.ToShortDateString());
}