A reasonably elegant solution today is to use 'upcast' and declare the type on the variable.

1
2
3
4
5
6
7
8
9
10
 

let mylist : obj list =

    [ upcast "foo"

      upcast new System.Exception()

      upcast 32 ]
By on 4/13/2009 11:43 AM ()

Thanks Brian. I didn't know about upcast (and downcast). (I should probably read the F# language specification.)

By on 4/13/2009 1:04 PM ()

A reasonably elegant solution today is to use 'upcast' and declare the type on the variable.

Ok, that works :-)

By on 4/13/2009 11:48 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