getch() in C#

    Date: 02/10/07 (C Sharp)    Keywords: no keywords

    Is there anything wrong with the following to emulate getch() (aside from not handling exceptions) using .NET 2.0?

    using System;
    
    public class Input
    {
        static void Main(string[] args)
        {
            char ch = getch();
            Console.WriteLine("You entered: {0}", ch);
        }
    
        static char getch()
        {
            ConsoleKeyInfo cki = Console.ReadKey(true);
            return cki.KeyChar;
        }
    
    }
    

    Source: http://community.livejournal.com/csharp/81275.html

« treeview control and... || I really need help :( »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home