@BeeJay : Hey BeeJay, so according to the example above, if I was to write to the dataset in the order Amount 6.50, Date 20/09/2013 followed by the Emp and the Item, would this avoid me getting the "Key Already Used In Dictionary" error message?
No. If your keys consist only of Emp and Item it doesn't matter what order you set the properties you'll get a duplicate key error when adding the 2nd instace of BASKET to your DynaDict as the 2nd instance of BASKET has the same key values as the first instance. It doesn't matter in the slightest that there are other properties with different values on the instances of BASKET as those properties are not used as keys in your DynaDict.
You have two options available to you:
1. Turn on duplicates allowed on the DynaDict
2. Alter the keys on the DynaDict so that they are guaranteed to be unique for all possible instances of BASKET that could be added to that DynaDict
It's difficult to comment on which is the most appropriate option for your situation as we don't know the usage pattern for this DynaDict. For example, if you're not relying on there only ever being one object that is a match for a given key, or keys, option 1 would be the easiest to implement. However, if you need to rely on there only ever being one object that is a match for a given key, or keys, then you'll need to take option 2 and ensure you have appropriate keys on your DynaDict to ensure that no two instances of BASKET could ever result in a duplicate key error.
Cheers,
BeeJay.