Archive for the 'C#' Category

As requested by Scott, here’s the code to QuickTimer.
public struct QuickTimer : IDisposable
{
private readonly DateTime start;
private readonly string label;

public QuickTimer(string label)
{
this.start = DateTime.UtcNow;
this.label [...]


Scott linked to my previous post on the Schwartzian Transform. Not long after, Randal L. Schwartz himself (!!) drops by with a comment:
Wow. Interesting to see how different it looks in C#. Of course, I think the original in Perl still looks the most elegant.

As if response, Elton Wells comes up with an implementation [...]


I’ve been dabbling with the Wide Finder problem and have found a solution in C# 3.0 that is startlingly elegant.


(Update 8/25: Changed the example scenario slightly.)
Inspired by Beautiful Code, which I just started reading yesterday, I’ve decided to post some beautiful code of my own. Specifically, I’d like to show off some of the fancy features of C# 3.0, and explain why they’re good for much more than just LINQ.
What’s a Schwartzian Transform? It’s [...]