我已填充數據讀取器從數據庫表和我有類似如何反序列的DataReader或數據表到c#類
public class CandidateApplication
{
public string EmailID { get; set; }
public string Name { get; set; }
public string PhoneNo { get; set; }
public string CurrentLocation { get; set; }
public string PreferredWorkLocation { get; set; }
public int RoleApplingFor { get; set; }
public string CurrentJobTitle { get; set; }
public int EducationLevel { get; set; }
public decimal SalaryExpected { get; set; }
public string AvailableTime { get; set; }
public int AdvertID { get; set; }
public bool SignForAlert { get; set; }
public string CVInText { get; set; }
public string CVFileName { get; set; }
public bool IsDownloaded { get; set; }
public string specialization { get; set; }
public bool isallocated { get; set; }
public int id { get; set; }
public string AdvertAdditionalInfo { get; set; }
}
我可以填充在環上面的類。我們可以迭代數據讀取器並填充類,但我想知道是否有任何捷徑從數據讀取器填充類。
如果數據反序列化可能從數據讀取器到類,那麼也告訴我,如果數據讀取器中沒有數據領域中存在的幾個字段,那麼如何處理這種情況。
這似乎在這裏得到解答: http://stackoverflow.com/questions/1464883/如何可以輕鬆地轉換datareader到列表 – markoo 2013-02-28 12:10:58