Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Best place to define enum?

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

    Best place to define enum?

    At the present time I have only one AddOn that I've developed for NinjaTrader, but I may develop others in the future. I'd like to define an enum that my present AddOn will use, and that future AddOns might use. Should I simply define my enum at the top of the .cs file for my present AddOn (say below the "using" declarations), or is there a better location for it? Thank you for any guidance you might provide.

    #2
    Hello NtFan,

    Thanks for the post.

    This really depends on how you want the final export/s to be. Is this going to be a source code export or compiled, also will this be one export zip file or are you going to release multiple zips?

    For a source code export, you can make this a separate .cs file and for each export you would select the enums .cs file as part of the export. During the import it will ask to replace it if it exists.

    For a compiled export:

    If this is one zip file you can put it at the top of one file in a namespace or make a separate .cs file and put your enum in a specific namespace, all addons you export in that zip can share that enum by using its fully qualified name MyNamespace.MyEnum.

    If these are separate zips you will need to put the enum in a separate .cs file and then export that as a compiled reference. You can then delete the source code for the enum and re import it as a compiled reference. When you export each zip file you can select the reference as a requirement in the export dialog. This is required so that each individual zip references and imports only 1 copy of the enum code or makes sure its present. This also requires adding the dll manually to the zip using these steps: https://ninjatrader.com/support/help...esOrNativeDlls

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    557 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X