我希望创建一个相当广泛的属性网格,以包含多达400个可分配属性。
基于我在MSDN上看到的内容:
public class AppSettings
{
private bool saveOnClose = true;
private string greetingText = "Welcome to your application!";
private int itemsInMRU = 4;
private int maxRepeatRate = 10;
private bool settingsChanged = false;
private string appVersion = "1.0";
public bool SaveOnClose
{
get { return saveOnClose; }
set { saveOnClose = value;}
}
public string GreetingText
{
get { return greetingText; }
set { greetingText = value; }
}
public int MaxRepeatRate
{
get { return maxRepeatRate; }
set { maxRepeatRate = value; }
}
public int ItemsInMRUList
{
get { return itemsInMRU; }
set { itemsInMRU = value; }
}
public bool SettingsChanged
{
get { return settingsChanged; }
set { settingsChanged = value; }
}
public string AppVersion
{
get { return appVersion; }
set { appVersion = value; }
}
}
这种方法需要很长时间,而且效率非常低。我错过了填充一长串属性的更好方法吗?
如果有一种迂回方式从表格中抓取数据,我确实拥有.xls中的所有数据。