• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.

    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by glennts, Today, 08:24 PM
    2 responses
    4 views
    0 likes
    Last Post bltdavid  
    Started by ibabinov, 11-12-2019, 09:50 AM
    3 responses
    66 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by PrimoItch, 05-27-2020, 04:35 PM
    2 responses
    17 views
    0 likes
    Last Post bkonia
    by bkonia
     
    Started by RuthB, Yesterday, 09:41 PM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by Newtrader101, Today, 12:12 PM
    3 responses
    12 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Working...
    X