Welcome Guest! To access all forums & features, please register an account or sign-in. → Why register?






Photo

F# vs C#: when a functional approach wins over OOP

Today I'll illustrate how discriminated unions in F# can contribute to reducing code size and complexity, compared to a typical object-oriented approach. I'll present a problem, model it in typical object-oriented C#, then in typical functional F#, and contrast both approaches.

The problem: evaluate expressions of the form 1 + 2 * 3. The...



Photo

Casts in C#

I first tried to present this as an emotional rant on how no one seems to understand the subtle differences between the cast operators in C#. That proved to be rather long and uninteresting, so instead, I will succintly present their correct usage in hope some might stumble unto this article somehow and it might alleviate their ignorance.

1. The normal way...