• Elegant Code Cast


    View in iTunes Any Podcatcher

It’s the little things

A while ago, I wrote a blog post regarding Test Data Builders Refined. Earlier this week, I wrote a very simple base class that provides an implicit cast operator for the builder class:

public abstract class TestDataBuilder<TSubject> { public abstract TSubject Build(); public static implicit operator TSubject(TestDataBuilder builder) { return builder.Build(); } }

Even I can’t get it more complex than this :-).

kick it on DotNetKicks.com

2 Responses to “It’s the little things”

  1. ohh, very nice :)

  2. [...] It’s the little things - Jan van Ryswyk small code tip ‘ a very simple base class that provides an implicit cast operator for the builder class ‘ [...]

Leave a Reply

Close
E-mail It