I cannot figure out how to read user-input in a loop (with Console.ReadLine
). I\'m trying to create a note that lets me store what ever the user inputs, and exi
You need List of Notes in order to add as many notes as you want.
Additionally, you need to first save ReadLine
input check if the user really asked to exit otherwise keep adding notes.
var myNotes = new List();
var firstNote = new Note();
firstNote.addText("Hi there");
Note note;
while (true)
{
var input = Console.ReadLine();
if (input.Equals("exit", StringComparison.OrdinalIgnoreCase))
{
break;
}
note = new Note();
note.addText(input);
myNotes.Add(note);
}