Downcasts are done via :?>, upcasts via :> (or the upcast keyword if the type can be inferred).

Example:

1
2
3
4
5
6
7
8
9
10
11
12
 

> let s = "hi" :> obj;;

val s : obj = "hi"

> printfn "%s" (s :?> string);;

hi

val it : unit = ()
By on 11/24/2009 11:19 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper