Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace TestFieldIthink
- {
- public struct Storage
- {
- public string Name;
- public int Size;
- public List<string> items;
- private void ShowContent()
- {
- Console.Write("\n[*] Склад содержит следующие предметы: ");
- for (int i = 0; i < items.Count; i++)
- Console.Write(items[i] + ", ");
- Console.WriteLine();
- }
- public void Add()
- {
- Console.Write("[*] Введите вместимость склада: ");
- this.Size = int.Parse(Console.ReadLine());
- for(int i = 0; i < Size; ++i)
- {
- Console.Write($"\n[*] Введите {i + 1} предмет: ");
- string item = Console.ReadLine();
- items.Add(item);
- }
- ShowContent();
- }
- public void Delete(string item)
- {
- try { items.Remove(item); ShowContent(); }
- catch { }
- }
- }
- internal class Program
- {
- static void Main(string[] args)
- {
- List<Storage> storageList = new List<Storage>();
- Storage fruits = new Storage();
- fruits.items = new List<string>();
- fruits.Add();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment