Most code running on .Net is written in C#. So when you consider writing some code in F#, you probably already have a good amount of C# code. C# code you want to keep. It probably doesn’t make economic sense to port C# code to F#.
The good news is that you can start using F# anyway. F# and C# have excellent interoperability.
When F# was created, it was built with Interop towards C# in mind. The result is that you can call (almost) any C# code from F# in a convenient way – there are exceptions, but they are rare. You can even use most F# code from C#, but using, for example, discriminated unions and function currying results in verbose code.
I have written about our experience with F#-C# Interop here. Read it; there isn’t much more in this blog post, anyway 🙂
The only thing that is required is that you can split your C# and F# code into separate assemblies. And these assemblies need a strict direction of dependency – which is a good idea for all code, but this is another myth…
Happy Interop-ing!
[…] Myths about F#: We can’t use F# because we can’t rewrite everything from C#! You don’t have to… (Urs Enzler) […]