Extracting data from dictionary in dictionary

This is in the Xojo Framework
I have a Dictionary (Xojo.Core) Called parentDict

parentDict has three members: integerA, integerB, and daughterDict

daughterDict has two members: someDoubleA, someOtherDoubleB

If I want to access integerA this works fine

Dim acceptA As Integer acceptA = parentDict.Value("integerA")

If I want to access someOtherDoubleB I can do the following:

Dim receiveDoubleB As Double Dim receiveDaughterDict As New Xojo.Core.Dictionary receiveDaughterDict = parentDict.Value("daughterDict") receiveDoubleB = receiveDaughter.Value(someOtherDoubleB)

But I do not seem to be able to “simply” do this:

Dim receiveDoubleB As Double receiveDoubleB = parentDict.Value("daughterDict").Value.("someOtherDoubleB")

Therefore, I end up creating a new Dictionary ( receiveDaughterDict) for the sole purpose of extracting this Double - receiveDoubleB. Is this the accepted way of doing things? Do you have to go through the step of creating the new Dictionary? And why is my “simple” way not allowed?

Your original code is creating a new Dictionary, then immediately destroying it in favor of a reference to an existing Dictionary. Instead:

dim daughterDict as Xojo.Core.Dictionary = parentDict.Value( "daughterDict" )

Your simple way doesn’t work as written because Value returns an Auto, not a Dictionary. However, casting might work:

receiveDoubleB = _
  Xojo.Core.Dictionary( parentDict.Value( "daughterDict" ) ).Value( "someOtherDoubleB" )

I haven’t tested this and, frankly, for debugging and readability, I’d do it the first way.

I did test it and it did work.

Thanks, because if nothing else it cleared a few cobwebs from my Xojo worldview.

And I actually prefer it, off hand,