开发者

F# using with indent syntax

there is

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

or

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

I want indent but without c alike

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

How can I do i开发者_Python百科t ?


There's no way to do that; since Open is an instance method it needs to be preceded by the object which it's being called on.

I'd typically avoid using entirely and use a use-binding:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜