title: C# assy in Powershell - calling contructor with enum params defined within the class
body: <p>It seems that the problem I'm having hasn't been covered in any topic, or at least
  I didn't find any yet.</p>
  
  <p>I'm trying to use a C# assembly in which the constructor expects a enumerator type parameter
  that is also defined within the class.</p>
  
  <pre><code>    namespace Utils.Translate
  {
      /// &lt;summary&gt;
      /// Converts ASCII to EBCDIC or vice-versa
      /// &lt;/summary&gt;
      public class AsciiEbcdic
      {
         /// &lt;summary&gt;
         /// The enumerator CharSet2Use determines which target character set to use.
         /// &lt;/summary&gt;
         public enum CharSet2Use 
         {
            A2E = 0,          //ASCII to EBCDIC
            E2A               // EBCDIC to ASCII
         };
  
         // Constructor
         public AsciiEbcdic( CharSet2Use whichSet )
         {
         }
      }
  }
  </code></pre>
  
  <p>No problem loading the assembly:</p>
  
  <pre><code>[System.Reflection.Assembly]::LoadFile( "EbcdicAscii.dll" )
  </code></pre>
  
  <p>However, when I try to instantiate it, with</p>
  
  <pre><code>$nameSpace = "Utils.Translate.EbcdicAscii"
  
  $var = New-Object $nameSpace( [Utils.Translate.EbcdicAscii+Char2Set2Use]::A2E )
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Unable to find type [Utils.Translate.EbcdicAscii+Char2Set2Use]: make sure that the assembly containing this type is loaded.
  </code></pre>
  
  <p>I also tried the following:</p>
  
  <pre><code>$var = New-Object $nameSpace -ArgumentList [Utils.Translate.EbcdicAscii+Char2Set2Use]::A2E
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>New-Object : Cannot find type [Utils.Translate.EbcdicAscii]: make sure the assembly containing this type is loaded.
  </code></pre>
  
  <p>Also tried passing the parameter as A2E, 'A2E', 0, '0' to no avail.</p>
  
  <p>Is there any way to instantiate this object passing an enumerator data type defined within the class?</p>