title: VisualBasicValue<T>: Access custom classes and its methods\properties
body: <p>Suppose I've a custom class (any class), with its methods and properties:</p>
  
  <pre><code>public class Test
  {
      public string MyString { get; set; }
      public bool MyBool { get; set; }
  
      public override string ToString()
      {
          return "Test Class : " + this.MyString + " - " + MyBool;
      }
  }
  </code></pre>
  
  <p>Now I want to move and handle its properties between WF4 activities using <code>VisualBasicValue&lt;T&gt;</code>. For example:</p>
  
  <pre><code>public class Program
  {
      static void Main(string[] args)
      {
  
          Test testClass = new Test() 
          {
              MyString = "some string",
              MyBool = true
          };
  
          Sequence wf = new Sequence()
          {
              Variables =
              {
                  new Variable&lt;Test&gt;("varName", testClass),
              },
  
              Activities =
              {
                  new WriteLine() { Text = new VisualBasicValue&lt;string&gt;("\"Test Class Properties: \" &amp; varName.MyString &amp; \"-\" &amp; varName.MyBool") },
                  new WriteLine() { Text = new VisualBasicValue&lt;string&gt;("\"Test Class ToString(): \" &amp; varName") }
              }
          };
  
          WorkflowInvoker.Invoke(wf);
  
          Console.ReadKey();
      }
  }
  </code></pre>
  
  <p>This code compiles without a problem. Variable can handle any kind of class, but while running it seems to complain of the custom class usage. Some exception like:</p>
  
  <pre><code>The following errors were encountered while processing the workflow tree:
  'Literal&lt;Test&gt;': Literal only supports value types and the immutable type System.String.  The type WorkflowConsoleApplication3.Test cannot be used as a literal.
  'VisualBasicValue&lt;String&gt;': Compiler error(s) encountered processing expression ""Test Class ToString(): " &amp; varName".
  </code></pre>
  
  <p>Operator '&amp;' is not defined for types 'String' and 'WorkflowConsoleApplication3.Test'.</p>
  
  <p>I've read that you can do something along this lines:</p>
  
  <pre><code>VisualBasicSettings vbSettings = new VisualBasicSettings();
  vbSettings.ImportReferences.Add(new VisualBasicImportReference()
  {
      Assembly = typeof(Test).Assembly.GetName().Name,
      Import = typeof(Test).Namespace
  });
  
  // construct workflow
  
  VisualBasic.SetSettings(wf, vbSettings);
  
  WorkflowInvoker.Invoke(wf);
  </code></pre>
  
  <p>But that doesn't seems to do the trick. Any help?</p>
  
  <p>PS: At the same topic, can someone give me a little example how\where to use <code>VisualBasicReference&lt;T&gt;' with</code>OutArgument`? It seems something I can use at a later stage but I'm to find any kind of example.</p>