Thomas
Thomas

Reputation: 12087

how to replicate this C# initialization code in F#

I have this in C#:

_RestClient.ConfigureWebRequest(r =>
{
    r.ServicePoint.Expect100Continue = false;
    r.KeepAlive                      = true;
});

what is the syntax to replicate this in F#?

Upvotes: 2

Views: 122

Answers (1)

Fyodor Soikin
Fyodor Soikin

Reputation: 80734

Lambda-expressions in F# are denoted fun x -> ... - equivalent to C# x => ...

Mutation (aka "assignment") is denoted x <- y - equivalent to C# x = y

So, to put that all together, you'd get this:

_RestClient.ConfigureWebRequest(fun r ->
    r.ServicePoint.Expect100Continue <- false
    r.KeepAlive <- true
)

Upvotes: 1

Related Questions