title: How to force array type?
body: <p>When I run <code>Get-ChildItem</code> in a directory with only one file, I get a single <code>DirectoryInfo</code> object:</p>
  
  <pre><code>PS H:\&gt; (ls).GetType().Name
  DirectoryInfo  
  </code></pre>
  
  <p>As soon as I add a second file, the output becomes an array:</p>
  
  <pre><code>PS H:\&gt; (ls).GetType().Name
  Object[]
  </code></pre>
  
  <p>How should I deal with this dichotomy in a function? Ideally, I'd like to force it to return an <code>Array</code> even when there's only one element, preferably without having to put in conditional logic based on the result of <code>GetType()</code> or <code>Length</code> or whatever.</p>