Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Singleton Classes - Where do they go?

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

    Singleton Classes - Where do they go?

    I have a Singleton that I wish to use with an AddOn. I have tried several different namespaces and/or derived classes, but can't seem to find a combination that will give me good access to the "NinjaTrader.NinjaScript" features.

    It looks like this is due to the private constructor of the singleton. Once I make the constructor public the issue goes away, but then it isn't a singleton.

    Is there a derived class I don't know about that will not try to Initiate my singleton, but still fits into the architecture of NT8?

    #2
    You can place your singleton in any namespace, the namespace doesn't matter much outside code collision purposes and doesn't actually inherit or give functionality depending on where you place it. Just influences the using statements you would need to use for methods. If I was going to place a singleton I'd likely place it in my own namespace to keep my code separate to prevent collision if possible.

    I can't think of any reason why a public vs private constructor would make any difference here. What exactly are you referring to wanting to access for "good access to NinjaTrader.NinjaScript features", could you give one or two examples and I could help guide you.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rhyminkevin, Today, 04:58 PM
    3 responses
    46 views
    0 likes
    Last Post Anfedport  
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    7 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    50 views
    0 likes
    Last Post futtrader  
    Working...
    X