Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ienumerator
- {
- class person
- {
- public person(string first, string second)
- {
- fname = first;
- lname = second;
- }
- public string fname { get; set; }
- public string lname { get; set; }
- }
- class person_list
- {
- public person[] list;
- public person_list(person[] per)
- {
- list = new person[per.Length];
- for (int i = 0; i < per.Length; i++)
- {
- list[i] = per[i];
- }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- person[] names = new person[3]
- {
- new person("some","one"),
- new person("another","one"),
- new person("sss","ssdad"),
- };
- person_list list_of_names = new person_list(names);
- int i = 0;
- while (i < list_of_names.list.Length)
- {
- Console.WriteLine(list_of_names.list[i].fname);
- i++;
- }
- Console.Read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement