Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. namespace ienumerator
  2. {
  3.  
  4. class person
  5. {
  6. public person(string first, string second)
  7. {
  8. fname = first;
  9. lname = second;
  10. }
  11. public string fname { get; set; }
  12. public string lname { get; set; }
  13. }
  14.  
  15. class person_list
  16. {
  17. public person[] list;
  18. public person_list(person[] per)
  19. {
  20. list = new person[per.Length];
  21. for (int i = 0; i < per.Length; i++)
  22. {
  23. list[i] = per[i];
  24. }
  25. }
  26. }
  27.  
  28. class Program
  29. {
  30. static void Main(string[] args)
  31. {
  32. person[] names = new person[3]
  33. {
  34. new person("some","one"),
  35. new person("another","one"),
  36. new person("sss","ssdad"),
  37. };
  38.  
  39. person_list list_of_names = new person_list(names);
  40. int i = 0;
  41. while (i < list_of_names.list.Length)
  42. {
  43. Console.WriteLine(list_of_names.list[i].fname);
  44. i++;
  45. }
  46. Console.Read();
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement