Comparing F# with C#: Downloading a web page
https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/posts/fvsc-download.html
// "open" brings a .NET namespace into visibility
open System.Net
open System
open System.IO
// Fetch the contents of a web page
let fetchUrl callback url =
let req = WebRequest.Create(Uri(url))
use resp = req.GetResponse()
use stream = resp.GetResponseStream()
use reader = new IO.StreamReader(stream)
callback reader url测试代码
Last updated