title: How to create a new InArgument<T> where the T can be changed dynamically
body: <p>In a rehost WorkflowDesigner, I want to assign a valiable to InArguments by following code:</p>
  
  <pre><code> Type inActivityType = leftActivity.GetType();
   PropertyInfo inPropInfo = inActivityType.GetProperty(inArgumentName);
   InPropInfo.SetValue(leftActivity, 
                       new InArgument&lt;someType&gt;(new VisualBasicValue&lt;someType&gt;(variableName)), 
                       null);
  </code></pre>
  
  <p>Since the "someType" is assigned with different type dynamically, the regular way to create a new InArgument will not working. One idea I found is:</p>
  
  <pre><code>//  Type theType - the value of theType will be assigned dynamicly, 
  //  base on different InArgument be selected
  
   Type InArgType = typeof(InArgument&lt;&gt;).MakeGenericType(new[] { theType });
   object InArg = Activator.CreateInstance(InArgType);
  .  .  .
    InPropInfo.SetValue(leftActivity, 
                       InArg, 
                       null);
  </code></pre>
  
  <p>But the problem is, I can only create a new InArgument, but can not assign new VisualBasicValue(variableName) to it.</p>
  
  <p>Thanks for any idea.</p>