Category Archives: Syntax Puzzles

Pattern matching in C# – part 1

In my previous post, I tried to explain what pattern matching is, and in particular the F# match expression, that I’m trying to mimic in C#. For my first attempt, I’ll try to analyse the matching cases that can apply … Continue reading

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

Pattern matching in C# – introduction

Although bringing real pattern matching to C# in not my objective, I’ve tackled yet another syntax puzzle, trying to build a “sort-of” F#-ish pattern-matching-like syntax. Disclaimer : as you can see from the quotes and italic, don’t expect me to … Continue reading

Posted in Functional Inspiration, Syntax Puzzles | 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

Polymorphic enums in C# ?

Using Java as a inspiration source for C# (hmm wait, hasn’t that already been done from the start ?) A few weeks ago, I read this post by @cyriux, describing how you could use polymorphic enums in Java. Actually, I … Continue reading

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