[text] updated

Viewer

  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.IO.Pipes;
  5. using System.Linq;
  6. using System.Runtime.Remoting.Metadata.W3cXsd2001;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9.  
  10. namespace Assignment3
  11. {
  12.     internal class Program
  13.     {
  14.         static void Main(string[] args)
  15.         {
  16.  
  17.             Console.WriteLine("Welcome to Modern Appliances!");
  18.             Console.WriteLine("How may we assist you?");
  19.  
  20.             Console.WriteLine("1- Check out Appliance", "\n2- Find Appliances by brand", "\n3- Display appliances by type", "\n4- Produce random appliance list", "\n 5- Save & exit");
  21.  
  22.             Console.WriteLine("Enter Option: ");
  23.             string option = Console.ReadLine();
  24.  
  25.             int choice = int.Parse(option);
  26.  
  27.             while (choice == 1)
  28.             {
  29.                 Console.WriteLine("Working");
  30.  
  31.                 Console.WriteLine("Enter the Item number of an appliance: ");
  32.                 string AppId = Console.ReadLine();
  33.                 int choice2 = int.Parse(AppId);
  34.  
  35.  
  36.                 string[] lines = File.ReadAllLines("C:\\Users\\himal\\Desktop\\Assignment3\\Assignment3\\appliances.txt");
  37.  
  38.                 string filepath = "C:\\Users\\himal\\Desktop\\Assignment3\\Assignment3\\appliances.txt";
  39.                 File.ReadAllLines(filepath);
  40.  
  41.                 foreach (string line in lines)
  42.                 {
  43.                     string[] parts = line.Split(';');
  44.                     string id = parts[0];
  45.                     string name = parts[1];
  46.                     string value = parts[2];
  47.                     string colour = parts[3];
  48.  
  49.  
  50.                 }
  51.  
  52.  
  53.             }
  54.             
  55.         }
  56.                     
  57.  
  58.  
  59.  
  60.         
  61.     }
  62. }

Editor

You can edit this paste and save as new: