1

Im looking to hold pairs of data that I can recall and change at points in time within my code.

The two pieces of data are strings, one being a name and one being a time (formatted hh:MM:ss).

The times are triggers that scripts will run, the name being the script name in question.

Both of these values may be duplicate (scripts running more than once a day and different scripts running at the same time "trigger")

I've tried to use a Dictorionary but found it isnt fit for purpose as either/or of the pairs can be duplicate.

Would a better way of structuring this be a dictionary using the time as a key and List for the scripts that need to run at that time? Or is there an entirely better way of holding this kind of data that Im not aware of?

Ben R
  • 85
  • 6

1 Answers1

2

Try using a Lookup. They allow duplicate keys, but works a bit like a dictionary.

gmn
  • 4,199
  • 4
  • 24
  • 46
  • I've used Dictionary> with success overnight, are there any pro's/cons with the Lookup compared to dictionary? Off the top of my head I can only think of speed when it comes to iterating through a dictionary (I've read this is somewhat of a no-no) – Ben R Mar 07 '18 at 10:36
  • @BenR take a look at https://stackoverflow.com/questions/13362490/difference-between-lookup-and-dictionaryof-list – gmn Mar 07 '18 at 10:51
  • awesome, that explained it well enough, the Dictionary> is what i need since its mutable (now understand what that means too). thanks for the link and recommendation! – Ben R Mar 07 '18 at 15:10
  • if this is you're answer, please could you accept it as the answer? – gmn Mar 07 '18 at 19:11
  • Ill accept it as the answer for the comments attached, I did not use a lookup but you assisted me in understanding the correct method – Ben R Mar 08 '18 at 11:09