typeof operator

Category:
Data Types
Description: Demostrate how to use typeof operator.
Code:
let SampleTypeOf() = 
let intType = typeof
printfn "%s can be retrieved by using typeof" (intType.Name)

Execution Result:
Int32 can be retrieved by using typeof

Last edited Sep 14, 2011 at 2:29 AM by ttliu2000, version 1

Comments

elvincheng Jan 5, 2012 at 8:16 AM 
Missing the 'int' type argument. The correct one should be

let SampleTypeOf() =
let intType = typeof<int>
printfn "%s can be retrieved by using typeof" (intType.Name);;