Archive for the 'C#' Category
Code sample: QuickTimer
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 [...]
Filed under: C# | 4 Comments
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 [...]
Filed under: C#, LINQ | 2 Comments
Wide Finder with LINQ
I’ve been dabbling with the Wide Finder problem and have found a solution in C# 3.0 that is startlingly elegant.
Filed under: C#, Concurrency, LINQ | 2 Comments
Schwartzian Transform in C# 3.0
(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 [...]
Filed under: C# | 13 Comments
