This may help:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 

open System
let matchType (o:obj) =
    match o.GetType() with
    | t when t = typeof<string> -> printfn "It is a string."
    | t when t = typeof<Tuple<_,_>> -> printfn "It is a Tuple<obj,obj>!"
    | t when t = typeof<Tuple<int,int>> -> printfn "It is a Tuple<int,int>!"
    | t when t.GetGenericTypeDefinition() = typedefof<Tuple<_,_>> -> printfn "It is a Tuple<?,?>!"
    | t -> printfn "Unmatched type: %A" t

matchType "Hello"
matchType (box 3, box 4)
matchType (3,4)
matchType (3.1,4.1)

By on 5/24/2009 12:57 AM ()

Yes, helps out a lot! Thanks.

By on 5/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