Hello I'm pretty new still to Ninjascript and C#. I have a couple of questions regarding the use of Dictionaries. I made a Dictionary to store Bar Numbers, each Key has a List as a Value;
Dictionary<int, List<int>> BarList = new Dictionary<int, List<int>>();
After creating a key. Each key is later updated like this:
BarList[Counter] = new List<int>{Signal1, Signal2, Signal3, Signal4};
Question1: I could not get AddOrUpdate to work at all with Dictionaries, so every time I want to store a value I have to create a new List. Is AddOrUpdate not supported?
========
Question2: I'm Printing the output like this:
foreach (KeyValuePair <int, List<int>> Entry in BarList)
{
Print (string.Format(@"Key: {0}", Entry.Key));
foreach (var item in Entry.Value)
{
Print (string.Format(@"Bar Number: {0}", item));
}
}
This Outputs this:
Key: 129
Bar Number: 3174
Bar Number: 3175
Bar Number: 3176
Bar Number: 3177
How would I go about Combing the Print outputs into 1 Line? like so:
Key 129: Bar numbers: 3174, 3175, 3176, 3177

Comment