Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Reflection;
- public class Program
- {
- static string strC = "";
- public static void Main()
- {
- List<Piec> piece = new List<Piec>();
- MenuStart();
- }
- static void AddProp(List<Piec> name)
- {
- name.Add(new Piec(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine()));
- Console.WriteLine("Element zostal dodany");
- Console.Write("Czy chcesz dodac kolejny elemento do listy? Y/N: ");
- string nothC = Console.ReadLine();
- if(nothC == "Y")
- {
- string listName = name.ToString();
- var dict = new Dictionary<string, List<Piec>>();
- dict[listName] = new List<Piec>();
- AddProp(dict[listName]);
- } else
- {
- MenuStart();
- }
- }
- static void ShowAll(List<Piec> name)
- {
- name.ForEach(i => Console.Write("{0},{1},{2},{3}", i.id, i.ip, i.name, i.web));
- }
- static void MenuStart()
- {
- Console.WriteLine("MENU WYBORU:");
- Console.WriteLine("1. Dodaj nowy element.");
- Console.WriteLine("2. Modyfikacja elementu.");
- Console.WriteLine("3. Usunięcie elementu.");
- Console.WriteLine("4. wyswietl elementy.");
- strC = Console.ReadLine();
- switch (strC)
- {
- case "1":
- Console.WriteLine("Podaj nazwę listy:");
- string listName = Console.ReadLine();
- var dict = new Dictionary<string, List<Piec>>();
- dict[listName] = new List<Piec>();
- AddProp(dict[listName]);
- break;
- case "2":
- Console.WriteLine(5);
- break;
- case "3":
- Console.WriteLine(5);
- break;
- case "4":
- Console.Write("Wpisz nazwe listy ktora ma zostac wyswietlona: ");
- string setlistName = Console.ReadLine();
- var dict2 = new Dictionary<string, List<Piec>>();
- ShowAll(dict2[setlistName]);
- break;
- // Walidacja
- }
- }
- }
- public class Piec
- {
- public int id { get; set; }
- public int ip { get; set; }
- public string name { get; set; }
- public string web { get; set; }
- public Piec(int id, int ip, string name, string web)
- {
- this.id= id;
- this.ip = ip;
- this.name = name;
- this.web = web;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement