Recent snippets

  • Get running Visual Studio instances as DTE objects

    Get running Visual Studio instances as DTE objects. Based on

    0 people like this

    Posted: 5 days ago by Gauthier Segay

  • Update Monad in F# based on Tomas Petricek article

    This is 100% based on tomas petricek blog article. there has been some small additions in regards to adding Result type and handling Monoids for the Writer Part. go check the following blog article : Comment appreciated + bear in mind that performance wise, the Monoid Combine operator, could be greatly improved and more.

    2 people like this

    Posted: 10 days ago by Fahd Abdeljallal

  • Optimal Cloud Coloring & famous 4 color map

    Four colors will print a map so adjacent states have different color. F# has clear concise code. Map has a list of pairs sharing a border. Incremental improvements in the code can be less use of key word 'function'. Since syntax is not ambiguous can it be fixed in the compiler? so '=function |' changes to '=|' ? Welcome to improve. Harrop,Mathias,Jack,Art,HR,fwaris,Don Syme, sffs... Thanks!

    2 people like this

    Posted: 12 days ago by Musa Jahanghir

  • empty list constructor

    Shows empty list constructor

    0 people like this

    Posted: 1 month ago by fsoikin

  • MailboxProcessor multi reader

    MailboxProcessor multi reader example

    2 people like this

    Posted: 2 months ago by Zack

  • Walkthrough: Creating an Asynchronous HTTP Handler

    The Microsoft tutorial Walkthrough: Creating an Asynchronous HTTP Handler did not describe how to use IHttpAsyncHandler from F#.
    It was also a bit complicated, because it did not show how to do it from Visual Studio. Here is the Visual Studio F# version. 1. Create empty ASP.NET Web Application. Call it FSharpHttpAsyncHandler. 2. Add a F# library project to the solution. Call it FSharpHttpAsyncHandler.Lib. 3. Add the following code to Library1.fs in FSharpHttpAsyncHandler.Lib 4. Add a reference to System.Web in FSharpHttpAsyncHandler.Lib 5. Add a reference to FSharpHttpAsyncHandler.Lib in FSharpHttpAsyncHandler. 6. Add the following to Web.config in FSharpHttpAsyncHandler. 7. In the Web tab of the project properties of FSharpHttpAsyncHandler, set Start url to http://localhost://whatever.SampleAsync 8. Run debug.

    4 people like this

    Posted: 2 months ago by Erling Hellenäs

Popular snippets

  • Chain of responsibility

    The following sample wants to make sure the person’s age is between 18 and 65, weight is no more than 200 and tall enough (>120).

    75 people like this

    Posted: 6 years ago by Tao Liu

  • Minimal XML DSL

    This snippet provides a very small internal DSL for creating and querying XML using the underlying XLinq classes.

    358 people like this

    Posted: 7 years ago by Blake Coverett

  • 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.

    62 people like this

    Posted: 7 years ago by Tomas Petricek

  • FSX Structure

    I use this basic template when writing .fsx files that I might want to compile. It adjusts the difference in command line/entrypoint handling between a script and a compiled assembly. This example shows the details for a WPF script — replace the #r's and/or remove the STAThread for a WinForms or Console script.

    116 people like this

    Posted: 7 years ago by Blake Coverett

  • Convert an object to json, and json to object

    There is a namespace System.Runtime.Serialization.Json To serialize generic object you can do like this...

    74 people like this

    Posted: 7 years ago by Tuomas Hietanen

  • Load XAML

    This example shows how to load a Xaml file allowing to use WPF from F#. It also shows how to access WPF objects and register event handlers.

    104 people like this

    Posted: 7 years ago by Antonio Cisternino

Snippets by tags

staging (18) seq (50) regex (12) async (92) design patterns (18) silverlight (21) lazy (18) dsl (22) recursion (26) computation builder (14) xml (12) learning f# (16) wpf (18) string (18) lists (13) tryfsharp (48) game (30) collections (16) html (14) tutorial (17)

View all...

Database contains 2185 snippets out of which 1500 is public.