distinct - Simple

Category:
LINQ
Description: This sample uses Distinct to remove duplicate elements in a sequence.
Code:
let LINQ03() =
let factorsOf300 = [2;2;3;5;5]

query {
for n in factorsOf300 do
distinct
} |> Seq.iter(fun n -> printfn "%d" n)

// sample output
// 2
// 3
// 5


Execution Result:
2
3
5

Last edited Sep 15, 2011 at 2:31 PM by Jackhu, version 2

Comments

No comments yet.