bugajakab

Untitled

Jan 26th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApp1
  9. {
  10.     class Person
  11.     {
  12.         // mezők , adattagok
  13.         public string name;
  14.         public string birthday;
  15.         public string birthplace;
  16.         // függvények, metódusok
  17.         public
  18.  
  19.     }
  20.    
  21.    
  22.     class vezerlo
  23.     {
  24.  
  25.         List<Person> lista = new List<Person>();
  26.         //fuggvenyek, metódusok
  27.         public void beolvas()
  28.  
  29.         {
  30.            
  31.  
  32.             StreamReader olvaso = new StreamReader("adatok.txt");
  33.  
  34.             while (!olvaso.EndOfStream)
  35.             {
  36.                 string[] sor = olvaso.ReadLine().Split(',');
  37.                 Person szemely1 = new Person();
  38.                 szemely1.name = sor[0];
  39.                 szemely1.birthday = sor[1];
  40.                 szemely1.birthday = sor[2];
  41.                 lista.Add(szemely1);
  42.  
  43.             }
  44.  
  45.         }
  46.         public void kiir()
  47.  
  48.         {
  49.             foreach (var item in lista)
  50.             {
  51.                 Console.WriteLine(item.name);
  52.             }
  53.  
  54.  
  55.  
  56.         }
  57.  
  58.  
  59.     }
  60.  
  61.     class Program
  62.     {
  63.         static void Main(string[] args)
  64.         {
  65.  
  66.             vezerlo vezerlo0 = new vezerlo();
  67.             vezerlo0.beolvas();
  68.             vezerlo0.kiir();
  69.  
  70.            
  71.  
  72.             Console.ReadKey();
  73.  
  74.         }
  75.     }
  76. }
Add Comment
Please, Sign In to add comment