.Net 4 Control-C Event Handler Broken

The Control-C, cancel, event handler defined as either: Console.CancelKeyPress += new ConsoleCancelEventHandler(myHandler); or as an anonymous delegate: Console.CancelKeyPress += delegate(  object sender, ConsoleCancelEventArgs e) { } appears to be broken in .Net 4. Sometimes it will work, other times it will drop you into a program fault. In .Net 3.5 it works fine, every time. [...]

Code Corner: Recurse Directory Structure in C# .Net

Here is a snatch of .Net (3.5) C# code to recursively trawl through a Windows file system. I wrote this so that I could add some flexibility (not shown) to the .GetFiles() method of the System.IO.Directory class. It’s easy enough to add some code to throw out files and folders that you’re not interested in, [...]

Follow

Get every new post delivered to your Inbox.