title: PowerShell Get-ChildItem invoke in C#
body: <p>I have this below powershell script to converted into a C#.</p>
  
  <pre><code>$file = $solution.DisplayName.substring(0, $solution.DisplayName.Length - 4) + ".dll"
  Get-ChildItem "C:\Windows\Microsoft.NET\assembly" -Filter $file -Recurse | Select-Object -ExpandProperty VersionInfo
  </code></pre>
  
  <p>I have tried this one but could not succeed.</p>
  
  <pre><code>        string dllName = "MyOwn.dll";
          PowerShell ps = PowerShell.Create();
          ps.AddCommand("Get-ChildItem");
          ps.AddParameter(@"C:\Windows\Microsoft.NET\assembly");
          ScriptBlock filter = ScriptBlock.Create(dllName);
          ps.AddParameter("-Filter", filter);
          foreach (PSObject result in ps.Invoke())
          {
              Console.WriteLine(
                  "{0,-24}{1}",
                  result.Members["Length"].Value,
                  result.Members["Name"].Value);
          } 
  </code></pre>
  
  <p>Also Is there any equivalent of Get-ChildItem in C# ?</p>
  
  <p>Please help.</p>
  
  <p>Thanks.</p>