C# function to F#
Converting from C# to F# is not hard, but requires some manual labor. Here you should convert a C# function using a C# class to a F# function using a C# class.
private static string GetData(Environment environment, string name)
{
var options = new DefaultOptions();
if (environment.IsDevelopment())
{
options.LocalCredentials = true;
options.Path = "/stuff";
}
else
{
options.LocalCredentials = false;
}
var uri = new Uri("https://example.com/" + name);
var client = new GetClient(uri, options);
return client.GetStuff(name);
}
let getData (environment: Environment) (name: string) : string =
let options = DefaultOptions()
if environment.IsDevelopment() then
options.LocalCredentials <- true
options.Path <- "/stuff"
else
options.LocalCredentials <- false
let uri = Uri("https://example.com/" + name)
let client = GetClient(uri, options)
client.GetStuff(name)