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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        80 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X