LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

New in labview: i want send a cluster to a function in c#. I can not.

To .Net Object doesn't work for custom datatypes (unless maybe when they implement some magic .Net class factory of something). You have to create them explicitedly yourself.

 

using System;
using System.Collections.Generic;
using System.Text;

namespace Test
{
    public struct Cluster
    {
        public int value;
        public string text;
    }

    public class TestClass
    {
        int test;

        public TestClass()
        {
            test = 0;
        }

        public int Initialize(int sequence, Cluster record)
        {
            test = record.value;
            return 0;
        }

        public int GetValue()
        {
            return test;
        }
    }
}

Initialize Test.png

This works!

Rolf Kalbermatter
My Blog
Message 11 of 12
(1,073 Views)

And by the way that example has an object leak! 

The cluster refnum needs a Close  node too after use!

Rolf Kalbermatter
My Blog
0 Kudos
Message 12 of 12
(433 Views)