[Migrated content. Thread originally posted on 08 June 2012]Hello!
From verson 9.0 (9.1 ?), AcuCobol handles stored objects. That is, we can send and receive objects as classes structs etc from ie. a C# method.
I am testing this, and for simpler objects I have managed to receive and handle objects correct.
But now I have a method that returns a C# Dictionary object.
This, I cannot figure out how to handle. Therefore I hope for an answer on this forum.
I have my return object in this handle:
77 hDictOperators usage is handle of Object value 0.
It is used in this call:
modify hMaventa "@GetOperators" (mav-returTabAnt)
The object is stored in this, and I get the correct result if I ie. ask for the number of instances:
inquire hDictOperators @Count ws-teller
I can also extract the keys into another stored object, like this:
inquire hDictOperators @Keys hDictKeys
But the question is; how can I extract the keys and values into pic x - variables?
The normal way of doing this in C# is by a foreach loop. I have tried to set the object in a perform - loop in my program, but have no succeed with that.
The dictionary has in C# a method "ElementAt". Where you could set the element to act on in the dictionary. This method also have a "Key" property, and a "Value". This is what I need. But I cannot find "ElementAt", and when trying to use this I get a compiler error. I have tried to make my definition file correctly, but this method, which is an inherited method, does not show.
I have also earlier asked the support department for several months ago, of how to use inherited methods/properties in stored objects, but have not got any answer yet.
I would be very grateful if someone could give me a code example of how to extract the "Key" and "Value" propertied of the dictionary into pic x - variables.!