This project is read-only.
select - Record Types 1

Category:
LINQ
Description: This sample uses select to produce a sequence of the uppercase and lowercase versions of each word in the original array.
Code:
type Record = {Upper :string; Lower:string}
let LINQ09() =

let words = ["aPPLE"; "BlUeBeRrY"; "cHeRry" ]

query {
for w in words do
select {Upper = w.ToUpper(); Lower =w.ToLower()}
} |> Seq.iter(fun r -> printfn "Uppercase: %s, Lowercase: %s" r.Upper r.Lower)

//sample output
// Uppercase: APPLE, Lowercase: apple
// Uppercase: BLUEBERRY, Lowercase: blueberry
// Uppercase: CHERRY, Lowercase: cherry


Execution Result:
Uppercase: APPLE, Lowercase: apple
Uppercase: BLUEBERRY, Lowercase: blueberry
Uppercase: CHERRY, Lowercase: cherry

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

Comments

No comments yet.