title: Returning complex object with PowerShell functions?
body: <p>Most of out of the box PowerShell commands are returning "complex" objects.</p>
  
  <p>for example, <code>Get-Process</code> returns an array of <code>System.Diagnostics.Process</code>.</p>
  
  <p>All of the function I've ever wrote was returning either a simple type, or an existing kind of object.</p>
  
  <p>If I want to return a home made objects, what are guidelines ?</p>
  
  <p>For example, imagine I have an object with these attributes: <code>Name</code>, <code>Age</code>. In C# I would have wrote </p>
  
  <pre><code>public class Person {
      public string Name { get; set; }
      public uint Age { get; set; }
  }
  </code></pre>
  
  <p>What are my options for returning such object from a PowerShell function ?</p>
  
  <ol>
  <li>As my goal is to create PowerShell module, should I move to a c# module instead of a ps1 file ?</li>
  <li>should I compile such objects in a custom DLL and reference it in my module using <code>LoadWithPartialName</code> ?</li>
  <li>Should I put my class in a powershell string, then dynamically compile it ?</li>
  </ol>