Stylist stylist1 = new Stylist(); // creates new styliststylist1.FirstName = "john";stylist1.LastName = "smith";stylist1.Phone = "123456789";stylist1.Email = "js@123.456";stylist1.Rate = "123";Stylist stylist2 = new Stylist(); // creates new styliststylist2.FirstName = "jane";stylist2.LastName = "doe";stylist2.Phone = "987654321";stylist2.Email = "jd@987.654";stylist2.Rate = "456";List<Stylist> stylists = new List<Stylist>(); // creates stylist liststylists.Add(stylist1);stylists.Add(stylist2);我想在控制台中显示列表的内容,但我只想显示FirstName和LastName,我该怎么做呢?我也做了一个叫做Stylist的定制类public class Stylist{ public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } public string Phone { get; set; } public string Rate { get; set; }}
2 回答
- 2 回答
- 0 关注
- 139 浏览
添加回答
举报
0/150
提交
取消