F#

2011-02-11 46 views
0

F#

using (new SqlConnection(insql)) (Open();) 

using (new SqlConnection(insql)) <| fun c -> 
    c.Open() 

我想縮進,但沒有使用C一樣

using (new SqlConnection(insql)) -> 
    Open() 

我該怎麼辦呢?

回答

3

有沒有辦法做到這一點;因爲Open是一個實例方法,它需要在其被調用的對象之前進行。

我通常避免using完全和使用use - 結合:

use c = new SqlConnection(insql) 
c.Open()