Created
May 8, 2013 08:54
-
-
Save DotNetNerd/5539170 to your computer and use it in GitHub Desktop.
Sample of extension method in F#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ExtensionFSharp | |
module CollectionExtensions = | |
type System.Collections.Generic.IEnumerable<'a> with | |
member this.ForEach(f:'a -> unit) = | |
for item in this do | |
f item | |
open System.Linq | |
open ExtensionFSharp.CollectionExtensions | |
let range = {1 .. 10} | |
range.ForEach(fun i -> printfn "%i" i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment