public class Customer { public string FirstName { get; set;} public string LastName { get; set;} public Address mAddress { get; set;} } public class Address { public string Street { get; set;} public string PostalCode { get; set;} public string City { get; set;} } public List<customer> SelectCustomer() { List<customer> CustomerList = new List<customer> (); while(dr.Read()) { Customer mCustomer =new Customer(); mAddress= new Address(); mCustomer.FirstName= dr["FirstName"].ToString(); mCustomer.FirstName= dr["LastName"].ToString(); mAddress.Street= dr["Street"].ToString(); mAddress. PostalCode = dr["PostalCode"].ToString(); mCustomer. mAddress= mAddress; CustomerList.Add(mCustomer); } return CustomerList; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)