OK I got it it was

1
2
3
4
5
6
7
8
9
10
11
12
member x.TryGetSetting (key:string, value:'c byref):bool =
            try
                let str = ConfigurationManager.AppSettings.Get(key)
                if str <> null then
                    value <- (Convert.ChangeType(str, typeof<'c>) :?> 'c)
                    true
                else
                    value <- Unchecked.defaultof<'c>
                    false
            with
            | :? ArgumentException -> false
            | _ -> rethrow()

The key was to change that

1
value <- Convert.ChangeType(str, typeof<'c>) :?> 'c

into that

1
value <- (Convert.ChangeType(str, typeof<'c>) :?> 'c)
By on 4/17/2009 11:15 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