Hi All,
I’m pretty sure there is an easy answer to this question, but I haven’t been able to find it yet. Here are the details:
- I have a dictionary named theDictonary
- theDictionary contains 5 entries of KeyValuePair<int, CustomClass> where the ints/Keys are 0,1,2,3,4
- I am looping through the dictionary entries and printing theDictionary[ i ] where i is going from 0 to 4.
The question I have pertains to what is returned when I print theDictionary[ i ]. It will return null. However, if I try to call the properties from theDictionary[ i ], the correct properties of that respective entry will be returned. So this means that it exists and is not null.
Why is it returning null when I try to print the object?
Thanks!
Can you show us your code?
When you say:
How are you accessing it if not “theDictionary”? Because you already said that returns null, so you must be accessing it a different way?
Show us the code where you fill the dictionary, and the code where you access the dictionary (null) and the properties (not-null).
provide us with code, don’t assume that 1) we have crystal balls and know what you’re doing, and 2) you’re understanding what’s going on – the simplest explanation would be that theDictionary doesn’t contain anything at all and is just empty. the other simplest explanation is that you’re trying to access it wrongly.
whatever the case, don’t assume, if you want help with scripting and it’s not just a concept, but the actual implementation, provide us with the script we can look at.