开发者

F# using with indent syntax

开发者 https://www.devze.com 2023-02-10 08:49 出处:网络
there is using (new SqlConnection(insql)) ( Open(); ) or using (new SqlConnection(insql)) <| fun c ->

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

精彩评论

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