views:

144

answers:

3

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

Most references dug up by Google resolve issues arising in older versions of Visual Studio and CTPs of F#.

It would rock if somebody could post a small howto. Thanks in advance.

A: 

You will need to make the F# code publicly available to other callers by encapsulating it in a type.

Mark Seemann
-1. this is one way to do it, but it's not _needed_: functions defined at the top level are exposed as public static members on a class with the same name as the enclosing module.
Kurt Schelfthout
+3  A: 

F#:

namespace MyFSharpCode

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

C#:

MyFSharpCode.MyType.Foo();
Brian
+4  A: 

F#:

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

C#:

Program.Foo();
Brian
Thanks for your answers. I found out I had a problem with F# namespaces, modules, and referencing the F# project.
ymihere