Skip to content

Instantly share code, notes, and snippets.

@banshee
Created May 26, 2016 16:57
Show Gist options
  • Save banshee/bbec82f52c92df98111398ed4c033cc3 to your computer and use it in GitHub Desktop.
Save banshee/bbec82f52c92df98111398ed4c033cc3 to your computer and use it in GitHub Desktop.
using System;
// Note that "using FSharpModule" (without "static") isn't legal C#.
// An FSharp module gets compiled into a type, and "using" specifically
// imports namespaces.
using static FSharpModule;
using FSharpNamespace;
using static FSharpNamespace.Class2;
#pragma warning disable 219 // no warnings about unused variables
namespace ConsoleSample
{
class MainClass
{
public static void Main (string [] args)
{
int a = FSharpModule.fn ();
FSharpModule.Class1 b = new FSharpModule.Class1 ();
// using static FSharpModule means we don't have to
// write "FSharpModule." before our types
int c = fn ();
Class1 d = new Class1 ();
FSharpNamespace.Class2 e = FSharpNamespace.Class2.Something;
Class2 f = Class2.Something;
// Allowed by "using static FSharpNamespace.Class2"
Class2 g = Something;
Class2 h = NewOtherThing (1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment