i am trying to make a program in which you have a list of workers,where you can add new workers and delete workers. I made a function which contained 5 names. i then want to make a second function to add 2 new names to the 1. function.
public static void Zaposlenici()
{
List<string> imena = new List<string> { "Marko","Ivan","Miljenko","Josip","Luka"};
foreach (var ime in imena)
{
Console.WriteLine(ime);
}
}
public static void Izbornik()
{
Console.WriteLine("1. Zaposlenici u firmi");
Console.WriteLine("2. Dodaj novog zaposlenika");
Console.WriteLine("3. Izbrisite zaposlenika");
Console.WriteLine("0. Izlaz");
Console.WriteLine("--------------------");
Console.WriteLine("");
Console.WriteLine("Odaberite opciju: ");
}
public static void DodajZaposlenika()
{
List<string> NovaImena = new List<string> { "Francis", "Matea" };
}
public static void Opcije()
{
int opcija= Int32.Parse(Console.ReadLine());
switch (opcija)
{
case 1:
Zaposlenici();
break;
default:
break;
}
}
static void Main(string[] args)
{
Console.WriteLine("Pozdrav!");
Console.WriteLine("---------------");
Izbornik();
Opcije();
}
}
I simply tried using the 1. function in the 2. so i thought i could just change it but i cant seem to be able to use the contents from the 1. function