Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Class member declaration expected

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

    Class member declaration expected

    I'm getting this error for this line, but it doesn't prevent compile, it just shows as an error until I compile - and it works. What's it complaining about?

    private Dictionary<(marketConditionName, double), marketConditionPerformanceTracker> marketConditionScoring = new Dictionary<(marketConditionName, double), marketConditionPerformanceTracker>();

    #2
    Hello Skifree,

    That is due to the dictionary parameters. While that is valid in C# the NinjaScript editor sees that as invalid due to the parenthesis in the dictionary type. ere you trying to use a tuple as the key? If so that needs to be defined like the following to avoid that error:

    Code:
    private Dictionary<Tuple<marketConditionName, double>, marketConditionPerformanceTracker> marketConditionScoring = new Dictionary<Tuple<marketConditionName, double>, marketConditionPerformanceTracker>();

    Comment


      #3
      Correct the tuple is a key, effectively a third column in the dictionary

      Comment


        #4
        Hello Skifree,

        Thanks for confirming. You should be able to use the code I provided in my last reply for that use case. You just need to use the format Tuple<T,T> instead.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        72 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        43 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        25 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        28 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        59 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X