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 object. Then, close the StreamReader object.

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 object to the text file, separating the fields with pipe characters. Then, close the StreamWriter object.

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!