Call the F # function in VB (or C # or whatever)

It seems I cannot call a dummy function created in F # from C # and / or VB.Net in Visual Studio 2010 Beta 1.

Most of the links caught by Google fix the problems that arise in older versions of Visual Studio and CTPs F #.

It will download if someone can post a small guide. Thanks in advance.

+3
source share
3 answers

F #:

// in Program.fs, last file in project
let Foo() =
    printfn "Hello from F#"

FROM#:

Program.Foo();
+5
source

F #:

namespace MyFSharpCode

type MyType() =
    static member Foo() =
        printfn "Hello from F#"

FROM#:

MyFSharpCode.MyType.Foo();     
+3
source

You will need to make the F # code publicly available to other callers to encapsulate it into a type .

-1
source

Source: https://habr.com/ru/post/1716084/


All Articles