Recent snippets

  • .NET Core 3 Windows Service

    With .NET Core 3 a template 'dotnet new worker' was created that allows services to be created. The template currently only works to create C# code so this snippet shows how I have translated the C# into F# and the steps needed to create the service. dotnet new console -lang F# -o FsharpService cd FsharpService dotnet add package Microsoft.Extensions.Hosting.WindowsServices dotnet add package System.Net.NameResolution Update the program.fs as shown below and then build and install the service dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true -o "./published" sc create fSharpService binPath= "<>\FsharpService.exe"

    1 people like this

    Posted: 2 days ago by Jackson McCann

  • Useful operator definition for interop with C#

    invokes op_Implicit when applied (for implicit conversions). I have found this to be very convenient when using C# libraries

    5 people like this

    Posted: 20 days ago by Faisal Waris

  • Configure F# Interactive to use Microsoft.ML.Net

    Until FSI gets package references, we are to reference DLLs individually. This script sets up the FSI session to use ML.Net - assuming the required packages are loaded in the default location for the solution. Normally, referencing the latest AutoML and TimeSeries packages will net all the packages listed here.

    4 people like this

    Posted: 27 days ago by Faisal Waris

Popular snippets

  • Hello world (F#)

    Classical "Hello world" example that prints a message to the console output. This version uses F# printfn function to do the printing.

    181 people like this

    Posted: 9 years ago by Tomas Petricek

  • Dynamic operator using Reflection

    Demonstrates how to implement the dynamic operator (?) using .NET Reflection. The implementation supports calling constructors, propreties and methods using simple overload resolution (based on parameter count). It handles instance as well as static members.

    65 people like this

    Posted: 9 years ago by Tomas Petricek

  • Pipeline list processing

    An example showing how to process list in a pipeline. We first use List.filter to return only even numbers and then use List.map to format them as strings.

    90 people like this

    Posted: 9 years ago by Tomas Petricek

Snippets by tags

mailboxprocessor (27) list (53) computation builder (14) json (14) f# (44) lazy (19) staging (18) array (22) monad (22) wpf (20) html (15) generic programming (16) design patterns (18) tryfsharp (48) collections (16) recursion (31) kata (17) silverlight (22) fold (21) tutorial (17)

View all...

Database contains 2427 snippets out of which 1633 is public.