Call F# code from C#

前端 未结 4 1734
抹茶落季
抹茶落季 2020-12-04 07:13

I am playing around with F# and C#, and would like to call F# code from C#.

I managed to get it to work the other way around in Visual Studio by having two project

4条回答
  •  不知归路
    2020-12-04 07:37

    It should 'just work', though you might have to build the F# project before a project-to-project reference from C# works (I forget).

    A common source of issues is namespaces/modules. If your F# code does not start with a namespace declaration, it gets put in a module with the same name as the filename, so that e.g. from C# your type might appear as "Program.Foo" rather than just "Foo" (if Foo is an F# type defined in Program.fs).

提交回复
热议问题