日期:2014-05-18 浏览次数:20466 次
//实体类,users.cs namespace OwnerUsers { public class Users { public Users(){} private int _id; private string _username; private string _password; public int ID { get{return _id;} set{_id = value;} } public string Userame { get{return _username;} set{_username= value;} } public string Password { get{return _password;} set{_password= value;} } } } //Test namespace OwnerUsers { pulic class Test { public static void Main(string[] args) { List<Users> list = new List<Users>(); for(int i=0; i<5; i++) { Users user = new Users(); user.ID = 1; user.Username = "U"+i.ToString(); user.Password = "P"+i.Tostring(); list.Add(user); } foreach(Users u in list) { Console.WriteLine("{},{1},{2}",u.ID,u.Username,u.Password); } } } }