示例#1
0
        private static void Task04()
        {
            List <String> myList   = new List <String>();
            int           whatToDo = 0;

            do
            {
                Console.Write("Lūdzu izvēlieties darbību (1- pievienot elementu, 2- izvadīt Listu, 3- iziet : ");
                whatToDo = InputNumberBetween("", 1, 3);
                switch (whatToDo)
                {
                case 1:
                    Console.Write("Ievadiet List elementu: ");
                    FileOperations.Write("Test", Console.ReadLine());
                    break;

                case 2:
                    Console.WriteLine();
                    myList = FileOperations.Read("Test");
                    if (myList.Count == 0)
                    {
                        Console.WriteLine("Lists ir tukšs");
                    }
                    else
                    {
                        Console.WriteLine(string.Join(", ", myList));
                    }
                    Console.WriteLine();
                    break;
                }
            } while (whatToDo != 3);
        }
示例#2
0
        static void Task02()
        {
            Console.WriteLine("Enter file name: ");
            String name = Console.ReadLine();

            List <String> List = new List <String> {
                "da", "fse", "gwg"
            };

            FileOperations.Write(List, name);

            FileOperations.Read(name);
        }