I’m trying to do Windows Console application which allows user to write any number of letters(string) in one line then after click ‘Enter’ moving to the next line etc. If user write in console "showme" then it should show him information: row number and number of letters in string in this row (image). There should be also "end" function which should close console, but it’s alread done.
My question is how to store typed by user strings and call them from "show" with such a information (i tried with arrays)
I’ve done something like this but it doesn’t work at all.
class Text
{
static void Main(string[] args)
{
Boolean endless = true;
ArrayList array = new ArrayList();
String s;
while (endless)
{
if(Console.ReadLine() == "showme")
{
Console.WriteLine("--------------");
}
if(Console.ReadLine() == "end")
{
Environment.Exit(0);
}
s = Console.ReadLine() + "\n";
array.Add(s);
}
s = Console.ReadLine();
}
}

Couple of things:
Consider using a
List<>vs.ArrayList(optional)Also, you are never adding the value of the
Console.ReadLine()to the ArrayList because it falls outside of your loop.