Question
C# please complete the code as per the instructions below: 1. Add code to the GetItems method that creates a StreamReader object with a FileStream
C#
please complete the code as per the instructions below:
1. Add code to the GetItems method that creates a StreamReader object with a FileStream object for the InventoryItems.txt file thats included in the project. (The Path constant contains the path to this file.) The file should be opened if it exists or created if it doesnt exist, and it should be opened for reading only.
2. Add code that reads each record of the text file, stores the fields, which are separated by pipe characters, in an InvItem object, and adds the object to the List
3. Add code to the SaveItems method that creates a StreamWriter object with a FileStream object for the InventoryItems.txt file. The file should be created if it doesnt exist or overwritten if it does exist, and it should be opened for writing only.
4. Add code that writes each InvItem object in the List
5. Test the application to be sure it works correctly.
The code is to be included in the attached project.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started