Tuesday, September 15th, 2009
I ran into a couple of issues when writing an F# class to be consumed by C#. Specifically when it came to adding attributes to a property declared on an interface. You would expect the following code to decorate the SofteningLength property with the Dependency and DefaultValue attributes: ...
Tags: C#, F#, Gotchas, Mixed languages, Unity
2 Comments »
Tuesday, September 8th, 2009
I’ve been using xUnit.net to run some basic acceptance tests. Obviously xUnit is a unit test framework first and foremost but I don’t have a problem with reusing the framework provided you’re really clear about which tests are unit tests and which tests are not. I created an AcceptanceTest ...
Tags: C#, Coding, Continuous integration, TDD, xUnit
No Comments »
Tuesday, September 1st, 2009
In part 1 and part 2 of my thread on C# optimization there was a lot of talk about algorithms and the like. The next two posts take a different tack… first re-implementing the same algorithm using different languages and then in a different language and hardware. It turns out ...
Tags: C#, Coding, Concurrency, NBody.net, Parallel Computing, Performance
No Comments »
Friday, March 13th, 2009
A long while back I wrote about An alternative to the C# generic new() constraint using anonymous delegates to provide a mechanism for constructing an object which did not support a parameterless constructor. I’ve updated the same post to show an improved syntax using lambda expressions.
Tags: C#, Coding
No Comments »
Tuesday, August 26th, 2008
I happened to come across the following code the other day. string cost = "FR" + "E" + "E"; // bad perf = true J
Which, after my performance investigation the other day, got me wondering again. Is there performance really going to be ...
Tags: C#, Coding, Performance
2 Comments »
Tuesday, August 19th, 2008
Last night I was playing around with a vector class that's part of a scientific computation code I've been working on. It's a long story more on that later but it means I've found some of my own time to write code in. Anyway... The Vector class uses the automatically ...
Tags: C#, Coding, Performance
9 Comments »
Tuesday, June 24th, 2008
I was mucking around with code snippets over the weekend - it killed the time in between feeling sick. As my unit testing framework of choice is XUnit I thought I've have a go at adding a snippet or two around that.
xUnit already comes with a nice code snippet for ...
Tags: C#, Code snippets, TDD, Visual Studio, xUnit
No Comments »
Thursday, June 5th, 2008
The System.Data.Linq.DataContext class exposes a TextWriter as the Log property allowing you to monitor the SQL that's getting executed under the covers. The trivial usage of this is to simply set the property to Console.Out and watch the results.
Given that I was adding the Enterprise Library 4.0 Logging Block to ...
Tags: C#, Coding, EntLib, Linq, xUnit
1 Comment »
Friday, April 18th, 2008
Some (not so) random surfing got me to this... How to get rid of the auto-generated #region for implemented interfaces - Daniel Cazzulino's Blog There's a setting in VS that allows you to turn off the #region generation when using VS's implement interface feature (ALT-SHIFT-F10). 99% of the time ...
Tags: C#, Coding, Visual Studio
No Comments »
Monday, November 12th, 2007
Here's something I came up with other the weekend while playing with some code... I wanted to write a method that ensured that some object of type T was always available. ModelElement element = EnsureElementExists<ModelElement>(_store);
Unfortunately in this case the ModelElement class does not have ...
Tags: C#, Coding
6 Comments »