标签:style blog http color os java ar for div
open System
let changeColor clr =
let orig = Console.ForegroundColor
Console.ForegroundColor <- clr
// 用对象表达式返回一个实现了 IDisposable 接口的对象
{ new IDisposable with
member x.Dispose () =
Console.ForegroundColor <- orig
}
[<EntryPoint>]
let main argv =
Console.WriteLine "原来的颜色"
do use clr = changeColor ConsoleColor.Red
Console.WriteLine "变成红色"
Console.WriteLine "好贱,又变回来了"
Console.ReadLine () |> ignore
0
标签:style blog http color os java ar for div
原文地址:http://www.cnblogs.com/greatim/p/3992313.html