When I run my program, the console window seems to run and close. How to keep it open so I can see the results?
class Program { public class StringAddString { public virtual void AddString() { var strings2 = new string[] { "1", "2", "3", "4", "5","6", "7", "8", "9"}; Console.WriteLine(strings2); Console.ReadLine(); } } static void Main(string[] args) { StringAddString s = new StringAddString(); } }
Put a Console.Read() as the last line in your program. That will prevent it from closing until you press a key
static void Main(string[] args) { StringAddString s = new StringAddString(); Console.Read(); }
1.4m articles
1.4m replys
5 comments
57.0k users