Sunday, January 24, 2010

I want to capture a user entered control break event in a C# console application. How can I go about this?

You would do something like this:





static void Main(string[] args)


{


Console.WriteLine(';Type Exit to break';);


string s = string.Empty;


while(s.ToUpper() != ';EXIT';)


{


s = Console.ReadLine();


//do something


Console.WriteLine(';Your result is ....';)


}


}

No comments:

Post a Comment