Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
4
Erster Beitrag:
vor 4 Jahren, 8 Monaten
Letzter Beitrag:
vor 4 Jahren, 8 Monaten
Beteiligte Autoren:
Alexandre Leclerc, Ned!

[WD18] .Net Dictionary

Startbeitrag von Ned! am 04.09.2013 08:29

Hi All,

I am using an external .Net assembly that returns a dictionary type.

This is what i have so far:


ND is "NDPublic.Service"
Dict is "System.Collections.Generic.Dictionary"

Dict = ND:GetAccInfo(sUsername,sPassword)
sKeys is string = Dict:Keys


This works up until I assign Dict:Keys to sKeys, where i get an error regarding incompatible types during assignment. Is there a way I can read the data that is contained in "Dict"

Thanks
Ned!

Antworten:

Hi Ned,

When you import a .Net assembly in Windev, look in the project tree/pane and open the .Net assembly folder.

You will find System.Collections.Generic, open the Dictionary type. You will see the whole class structure. Then the member Key is also a collection of objects.

Try working with get_Keys(), get_Count(), get_Item(), etc. and figure out the format of the returned value (sorry, I have not the time to investigate).

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 04.09.2013 12:27
Hi Alexandre,

Thanks for your reply. It appears I haven't got as a far as reading from teh dictionary. It looks like the data is not being loaded into the dictionary.

Is the method I am using to return the data to the DICT object correct?

Thanks
Ned!

von Ned! - am 06.09.2013 09:38
Hi Ned,

I think, first, your declaration is incorrect since you do not specify the key/value types. I have no experience using .Net in WinDev but maybe you can figure it out looking at some examples on the web (example: http://www.dotnetperls.com/dictionary). Try some simple tests first.

(In fact, the dictionary class is an "Associative array" in WinDev. Maybe you could load your data directly in an associative array? Try looking at what data format your .Net object returns to see if you can use an associative array directly.)

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 06.09.2013 12:30
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.