Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6083519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:24:44+00:00 2026-05-23T11:24:44+00:00

I was trying to call this function from f# http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.cloudstorageaccount.setconfigurationsettingpublisher.aspx The function signature is:

  • 0

I was trying to call this function from f#

http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.cloudstorageaccount.setconfigurationsettingpublisher.aspx

The function signature is:

CloudStorageAccount.SetConfigurationSettingPublisher
      (Action<string, Func<string, bool>>) : unit

The C# call goes something like this:

CloudStorageAccount.SetConfigurationSettingPublisher((configName,
                                                  configSettingPublisher) =>
{
    string configValue = "something"
    configSettingPublisher(configValue);
});

whereas in F#, I had to do something like this:

let myPublisher configName (setter:Func<string, bool>) =
    let configValue = RoleEnvironment.GetConfigurationSettingValue(configName)
    setter.Invoke(configName) |> ignore

let act = new Action<string, Func<string, bool>>(myPublisher)

CloudStorageAccount.SetConfigurationSettingPublisher(act)

Can this be written more concisely in f#?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:24:44+00:00Added an answer on May 23, 2026 at 11:24 am

    F# automatically converts lambda functions created using the fun ... -> ... syntax to .NET delegate types such as Action. This means that you can use lambda function as an argument to SetConfigurationSettingPublisher directly like this:

    CloudStorageAccount.SetConfigurationSettingPublisher(fun configName setter ->
        let configValue = RoleEnvironment.GetConfigurationSettingValue(configName)
        setter.Invoke(configName) |> ignore)
    

    A function of multiple arguments can be converted to a delegate of multiple arguments (the arguments shouldn’t be treated as a tuple). The type of setter is still Func<...> and not a simple F# function, so you need to call it using the Invoke method (but that shouldn’t be a big deal).

    If you want to turn setter from Func<string, bool> to an F# function string -> bool, you can define a simple active pattern:

    let (|Func2|) (f:Func<_, _>) a = f.Invoke(a)
    

    …and then you can write:

    TestLib.A.SetConfigurationSettingPublisher(fun configName (Func2 setter) ->
        let configValue = "aa"
        setter(configName) |> ignore)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to learn delegates in C# from this article http://msdn.microsoft.com/en-us/library/aa288459(v=vs.71).aspx I am
I am trying to use this simple function from this page: http://www.haskell.org/haskellwiki/99_questions/Solutions/2 But when
I am trying to learn how to call this write_data(…) function from the funmain()
I'm trying to call a function that contains jQuery code. I want this function
I am trying to call terminate function. [I think this function gets called when
I am trying to do the following: function main(callback) { $.ajax('server-side', function() { this.callback.call(hello);
Trying to interpret this error and why it is happening: Call to undefined function
I'm trying to call data from the Google Calendar API with help from this
I'm running into this problem when trying to call a SOAP Web Service from
So i am trying to call this function in my javascript but it gives

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.