CodePlexProject Hosting for Open Source Software
Using KeyNotFoundException and exception patterns
let ExceptionSample3() = try printfn "About to raise an exception..." match DateTime.Now.DayOfWeek with | DayOfWeek.Monday -> raise(KeyNotFoundException()) | _ -> failwith "it's not Monday" with | :? KeyNotFoundException -> printfn "Caught a 'KeyNotFoundException' exception, it must be Monday" | Failure msg-> printfn "Caught a 'Failure' exception: %s" msg
About to raise an exception...Caught a 'KeyNotFoundException' exception, it must be Monday
Last edited Sep 14, 2011 at 2:43 AM by ttliu2000, version 1
There is no recommended release for this project.