The F # library is expected to behave like C # when consumed.

I am developing a library in F # for use by another team using C #. With what things should I know that this other team expects this library to behave like any other C # library?

For example, if I use option types, I will need to convert them to null when I put it in C #. Some other possible transition areas may include computation expressions, FastFunc, events, and name problems.

+6
c # f #
source share
2 answers

The F # Component Development Guide is a document designed to answer exactly this question.

+14
source share

Make sure you don't expose any of the F # types, especially lists, maps, etc. (exposing something like Microsoft.FSharp.Collections.FSharpMap will certainly make the C # team go crazy). When you show a getter or return type, which is an F # collection, call List.toSeq and you will get IEnumerable , which is much better to work with C #.

Other than that, you should be fine. I used to use F # and C # for just one project, and that was my only real problem / annoyance interacting with the two.

+5
source share

All Articles