I am fairly new to functional programming and C#/F#.
What is unclear to me is: Can you do functional programming in C# and/or in F#?
Or is it something like, you write some OO code in C#, and some FP code in F#, and use them together?
1
Both F# and C# are .NET languages, meaning they both compile to IL code (which is similar to Java bytecode).
If you write your code to use a specific subset of IL (called CLS compliant – meaning it only uses features that are compatible with all .NET languages), you can use a library written in one .NET language in all other .NET languages.
Now, C# was created as an object oriented language – it has evolved over time and now has some functional features, meaning one can write in a functional style in C#.
F# was created as a functional language. It isn’t pure and can have side effects (in particular when using libraries written in other .NET languages, including the base class libraries).
There are no hard rules as to what style to use with which language, but yes, using F# for functional code and C# for OO code makes sense as that is what either language was created for and lends itself to.
And one can use them together, provided the code is written with interoperation in mind (not a hard requirement either, but it can make life easier).
5