Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

is it possible to pass param. names and arguments together when calling a function?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    is it possible to pass param. names and arguments together when calling a function?

    If one defines this function private void multiplyNumbers( int x, int y)

    When we call it, is it possible to pass the parameter names and arguments together like this:

    result = multiplyNumbers(x = 10, y = 25)

    When i try this with Ninjascript i get an error.

    #2
    I think i found my own answer:

    Comment


      #3
      Hello trenedisyourfriend,

      Thank you for your post.

      This would be a C# related question. Please note that it is against our policy to provide C# programming education services in our Support department.

      That said, the link you mentioned would be a good place to look for education on this topic. If you have a custom method, private void multiplyNumbers(int x, int y), then you would call that method as follows.

      multiplyNumbers(10, 25)

      I have personally found DotNetPerls to be a very helpful publicly available educational resource with simple, direct, and easy-to-follow examples.


      Other useful resources on learning C# that are publicly available:
      NinjaScript Debugging
      Softsteel Soluions
      CSharp Essentials
      C# Station
      The Code Project

      Let us know if we may assist further.
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment


        #4
        Thank you Brandon for your link.

        From the link i posted, i now know i can use these forms too:
        multiplyNumbers(x: 10, y: 25) or multiplyNumbers(y: 25, x: 10)

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        68 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        151 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X