03-14-2013 04:34 PM
I am supposed to feed a .NET object to a .NET DLL in LabVIEW. In the C# code example, it just equates the object input to a string. i am not sure how could it do that, since the DLL expects an object, and the C# code gives it a string.
In LabVIEW, I just use the "To .NET object" node to convert a string into an object. Then, I feed the object into the DLL. It works. It converts a LabVIEW datatype into a .NET object, but what about the new object's method, properties, and field? What kind of object is the node creating? Howcome it just work?
03-14-2013 05:01 PM - edited 03-14-2013 05:03 PM
I'm not a .NET programmer, but my understanding is that in .NET all data types are classes, so the function doesn't equate the object to "a string" but to "an object of class string" (which would be the same thing if you were writing .NET code).
Presumably LV has enough smarts to convert some of the .NET types to equivalent LV types (such as strings, numerics and booleans) and the To .NET Object VI is also smart enough to see that the data in your variant is a string and to create a .NET object of class string.
Obviously the actual type of the wire coming out of the function is the parent .NET object, but you should probably be able to down cast it to the string class and then get the relevant properties and methods.