title: Anonymous methods - C# to VB.NET
body: <p>I have a requirement to implement a single VB.NET instance of an application on a terminal server. To do this I am using code from the <a href="http://www.flawlesscode.com/post/2008/02/Enforcing-single-instance-with-argument-passing.aspx" rel="nofollow noreferrer">Flawless Code</a> blog. It works well, except in the code is written in C# and uses an anonymous method which is not supported in VB.NET.  I need to rewrite the following so that I can use it as an event in VB.NET. </p>
  
  <pre><code>static Form1 form;
  
  static void singleInstance_ArgumentsReceived(object sender, ArgumentsReceivedEventArgs e)
      {
          if (form == null)
              return;
  
          Action&lt;String[]&gt; updateForm = arguments =&gt;
              {
                  form.WindowState = FormWindowState.Normal;
                  form.OpenFiles(arguments);
              };
          form.Invoke(updateForm, (Object)e.Args); //Execute our delegate on the forms thread!
      }
  }
  </code></pre>