Tag Archives: C#

Functional Inspiration – A simple Option type

In F#, the option type is a built-in Discriminated Union type which allows to handle nicely the fact that an expression can represent some value or none. In C#, we have almost this construct when we use the Nullable<T>, but … Continue reading

Posted in Functional Inspiration | Tagged , | Comments Off

Elitism ? Or just raising the bar ?

Last Thursday, I’ve attended an open forum organised by ALT.NET France user group, about the Software Craftsmanship Community and the “Fier d’être développeur” (“Proud to be dev”) groups, in order to compare their intents and try to explain why they … Continue reading

Posted in Practices | Tagged , , | Comments Off

Cartesian products in LINQ (fluent syntax)

Have you ever tried to combines sequences in order to build Cartesian products in LINQ ? This is really easily achieved using the query expressions syntax, writing for instance : var ints = Enumerable.Range(1, 4); var longs = Enumerable.Range(1, 3).Select(i … Continue reading

Posted in LINQ | Tagged , , | Comments Off

Polymorphic enums in C#, implementation revealed

How can we implement a polymorphic enum to mimic the Java ones ? In a previous post, as an answer to @cyriux’s one, I showed how we could try to use a polymorphic enum in C# in order to mimic … Continue reading

Posted in Syntax Puzzles | Tagged , , , | Comments Off

Polymorphic enums in C#, generic incrementation

During the implementation of my polymorphic enum, I have chosen to allow several types for the underlying “ordinal” value, as it is also possible for standard C# enums… From the MSDN documentation, the allowed underlying types for enum types are … Continue reading

Posted in Syntax Puzzles | Tagged , , | Comments Off