Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Serialization question

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

    Serialization question

    I have developed an indicator that uses a lot of dictionaries. I have to do a lot of merging copying dictionaries.....

    Now I have created a method to copy one dictionary to another :

    This is an extension method..

    publicstatic T DeepClone<T>(this T a)
    {
    using (MemoryStream stream = new MemoryStream())
    {
    BinaryFormatter formatter =
    new BinaryFormatter();
    formatter.Serialize(stream, a);
    stream.Position =
    0;
    return (T)formatter.Deserialize(stream);
    }
    }


    Now I have to copy (DeepClone()) one dictionary that contains an object. Here is the class :

    internalclass items
    {
    publicdouble up=0;
    publicdouble down=0;
    publicint dailyBars=0;
    }

    I get a message that items is not marked as serializable...

    What do I have to do to serialize this object (items)...


    I just put [Serializable()] in front of the class but didn't work..

    Thank you




    #2
    Unfortunately this is a more advanced C# question than the scope of what we can support. The general idea of how to serialize objects can be seen here though: http://www.ninjatrader.com/support/f...ead.php?t=4977
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

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