public class Customer { private int id; private string name; private string region; private int phone; public int Id {get, set} public string Name {get, set} public string Region {get, set} public int Phone {get, set} }
var c = new Customer { Id = Convert.ToInt32(r[0]), Name = r[1].ToString(), Region = r[2].ToString(), Phone = Convert.ToInt32(r[3]) }
Convert.IsDBNull
var c = new Customer { Id = Convert.ToInt32(r[0]), Name = r[1].ToString(), Region = r[2].ToString(), Phone = Convert.IsDBNull(r[3]) ? 0 : Convert.ToInt32(r[3]) }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)