Question: Write instructions that will do the following. It will open an output file with the directory name options.txt. It will write each of the items
- Write instructions that will do the following. It will open an output file with the directory name options.txt. It will write each of the items in a list box named lstOptions onto the output file as a line. When the last item is written, close the file.
Here is what i have, is it correct. If not, how should it be coded using C#?
StreamWriter outputFile;
string theName
outputFile=File.CreateText(options.txt);
while (!outputfile.EndOfStream)
{
theName = outputFile.WriteLine();
lstOptions.Items.Add(theName);
}
namesFile.Close();
2. Write a method which will accept 2 list boxes as parameters and return an integer telling how many times an element of the first list box is found in the of the second list box.
Please answer question 2 using C#, thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
