bookmark

What does this C# code look like in F#? (part one: expressions and ...


Description

If you have C# code and just try to transliterate it directly to F#, the F# code you wind up with is unlikely to be idiomatic or "good". Nevertheless, when you are new to a language (F#), it is sometimes useful to know how to transliterate from a well-known language (C#) for those cases where you just don't know the idioms yet, but don't want that to prevent you from making progress. So today's blog entry takes the general form of "here's some C# code, how do I write the same thing in F#". It is intended to be used as a reference or as casual reading to discover some little-used or lesser-known F# syntax/operators/functions. Today's blog entry covers only code that goes inside a method body, so you won't find anything about declaring classes or using namespaces here. Instead I will be covering the following bits of C#: * casts * operators * expressions * statements and show a way to transliterate those C# forms into F#.

Preview

Tags

Users

  • @draganigajic

Comments and Reviews