diff --git a/docs/fsharp/language-reference/type-extensions.md b/docs/fsharp/language-reference/type-extensions.md index e5764f33d444b..ec0c2bff3b9a6 100644 --- a/docs/fsharp/language-reference/type-extensions.md +++ b/docs/fsharp/language-reference/type-extensions.md @@ -70,7 +70,9 @@ static member Method(this T input, T other) This approach is particularly useful when the generic type parameter is constrained. Further, you can now declare extension members like this in F# code and define an additional, semantically rich set of extension methods. In F#, you usually define extension members as the following example shows: ```fsharp -type seq<’T> with +open System.Collections.Generic + +type IEnumerable<'T> with /// Repeat each element of the sequence n times member xs.RepeatElements(n: int) = seq { for x in xs do for i in 1 .. n do yield x } @@ -84,7 +86,7 @@ Consider the following declaration: [] type ExtraCSharpStyleExtensionMethodsInFSharp () = [] - static member inline Sum(xs: seq<’T>) = Seq.sum xs + static member inline Sum(xs: IEnumerable<'T>) = Seq.sum xs ``` By using this declaration, you can write code that resembles the following sample. @@ -102,4 +104,4 @@ In this code, the same generic arithmetic code is applied to lists of two types ## See Also [F# Language Reference](index.md) -[Members](members/index.md) \ No newline at end of file +[Members](members/index.md)