Is there a nice way to bring a custom c sharp class into vl now?

yes it is possible, but we want to wait with an official announcement since there is more to it then meets the eye. There will be a document that tells you all the details.

but for your personal experimentation, here is the unofficial quick guide:

  • locate the VL.Core.dll in the alpha download
  • reference it in your C# project
  • write a using clause for VL.Core in your class
  • use the Type attribute over your class (this is always required in order to make the Node attribute work)
  • use the Node attribute on every public method/property/field of your class that you want to turn into a VL node
  • compile the project as a DLL
  • reference this DLL as dependency in your .vl document
  • voila, use the data type and its nodes

it might look like this:

using System;
using VL.Core;

namespace MyVLNodes
{
    [Type] //this tells VL that the data type is available
    public class MyClass
    {
        [Node] //this makes a get and set node for MyField
        public int MyField;

        [Node] //this will also make get and set nodes
        public string MyProperty { get; set; }

        [Node] //this makes the Create node
        public MyClass(int initValue)
        {
            MyField = initValue;
        }

        [Node] //this makes a MyMethod node
        public bool MyMethod(int value)
        {
            return value < MyField;
        }
    }
}
1 Like