Vectors and ".NET Automatic Type Conversion"
Frederik Soete
Hi, fellow Magicians,
toggle quoted messageShow quoted text
I have included a piece of the Magic documentation below, which appears to offer tantalizing possibilities for converting vectors to and from .Net datatypes. Given that documentation, I must admit, in practice I am still not able to pass a vector of e.g. strings to a .Net snippet. Apparently the type conversion is not meant to do that? (But what does it do, I wonder?) Does anyone know a way to send the contents of a big vector to a .Net snippet, using this automatic conversion or something like it? I mean without creating a DotNet array variable, and then manually updating each individual cell through a laborious and timeconsuming block-while-loop? Or should I just give up on the idea of a fast way of passing a vector to .Net? Thanks in advance, for all help in understanding this arcane part of the Magic documentation. Bye, Frederik Soete
|
||||||||||||||||||
|
||||||||||||||||||
Frederik Soete
Hi group,
In the meantime, I have tried my hand at the problem yet again. Contrary to what the docs seem to allow, I have still not succeeded in casting a Magic vector into a DotNet object in one go. But I have found a good workaround in the idea that you can fill a "System.Collections.ArrayList" object just like a vector, and pass that to a DotNet invoke. This should be adequate for most purposes. Better yet: the array list may contain all kinds of differently typed .Net objects. By the way, searching this group for "ArrayList", I have found a previous short post by Andreas Sedlmeier. Hats off to him. It just goes to show I should have searched the group more thoroughly before asking. That post's URL was: https://magicu-l.groups.io/g/main/message/176432 Thanks for reading, Frederik Soete.
|
||||||||||||||||||
|