cnd
cnd

Reputation: 33754

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 it ?

Upvotes: 0

Views: 197

Answers (1)

kvb
kvb

Reputation: 55184

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()

Upvotes: 3

Related Questions