LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cluster to .net object

Solved!
Go to solution

I'm trying to convert a cluster to a .NET object.  I know you can't do it directly, so I tried flattening the cluster to a string and creating a .NET object out of the flattened string.  This is not working either.  The flattened string will contain some unprintable characters and it appears that the returned string is truncated at the first unprintable character.  Is there a workaround for this?  Maybe if the string is converted to a byte array first?

 

TIA,

Bill F

0 Kudos
Message 1 of 4
(2,377 Views)

There really isn't a way of doing this directly. What's the .NET object that you are trying to cast to? Are you trying to cast it to a struct? If so, just call the constructor for the struct and then populate the members via property nodes. Then you can pass the struct object to the method/property that you are trying to call.

0 Kudos
Message 2 of 4
(2,376 Views)
Solution
Accepted by bfarley

I'm not trying to cast to a particulr .NET object.  I just want to box it to use a .Net collection class - a Hashtable in this case.  Turns out that converting the flattened string to a byte array worked.  I guess you could use this technique for any .Net collection class - pretty powerful.

 

Bill F

0 Kudos
Message 3 of 4
(2,368 Views)

Bill F

 

Can you post an example? I'm trying to do the same thing.

0 Kudos
Message 4 of 4
(2,261 Views)