The F#-C# Interop Sample

Links: Up

This sample shows how to do simple cross-language programming involving F# and C#. In particular it shows how to access the functionality of F# modules from C#, including how to access F#'s discriminated unions, tuples, records and function values. On Windows build the sample using build.bat and on Unix build using build.sh.

The first file (FSharpLibrary.fs) defines a software component using F#. The component publishes some simple types and functions, specified in the interface file (FSharpLibrary.fsi). The (CSharpProgram.cs) shows how the F# component can be used from C#.

Suggested Exercises