Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace input_output
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             List<string> studenti = new List<string>(new string[] { "Pavel", "Anna", "Petr", "PičoKurvaKdokoliv!!!!!" });
  15.             StreamWriter streamWriter = null;
  16.             try
  17.             {
  18.                 streamWriter = new StreamWriter("studenti.txt");
  19.                 foreach(string student in studenti)
  20.                 {
  21.                     streamWriter.WriteLine(student);
  22.                 }
  23.  
  24.             }
  25.             catch (Exception E)
  26.             {
  27.                 Console.WriteLine("KURVO");
  28.             }
  29.             finally
  30.             {
  31.                 if (streamWriter != null)
  32.                 {
  33.                     streamWriter.Close();
  34.                 }
  35.             }
  36.            
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement