I was browsing some code when I hit the following:
static TimeSpan Time(Action action)
{
var sw = Stopwatch.StartNew();
action();
return sw.Elapsed;
}
Not that this code is somewhat extraordinary, the beauty of this is precisely how simply we can write this code nowadays:
TimeSpan elapsed = Time(() => Matrix.Multiply(matA, matB, matC));
I just can’t stop being amazed with simplicity :)
1 comment:
Cool.
I really want to start using lambdas but I keep forgetting about them when there's a change to use them.
Post a Comment