开发者

F# library expected to behave like C# when consumed

I'm developing a library in F# f开发者_JS百科or consumption by another team using C#. What things should I look out for knowing that this other team expects this library to behave like any other C# library?

For example if I use Options types I'll need to convert them to null when I expose to C#. Some other possible transition areas could be computation expressions, FastFunc, events and naming issues.


The F# Component Design Guidelines is a document designed to answer exactly this question.


Make sure you don't expose any of the F# types, especially lists, maps, etc (exposing something of type Microsoft.FSharp.Collections.FSharpMap will surely make the C# team go nuts). When you're exposing a getter or a return type that is a F# collection, call List.toSeq and you'll end up with an IEnumerable, which is much nicer to work with in C#.

Other than that, you should be just fine. I've used F# and C# on only 1 project before, and that was my only real issue/annoyance interoperating the two.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜