PowerShell type accelerators: PSObject vs PSCustomObject
<p>In PowerShell v3.0 <code>PSCustomObject</code> was introduced. It's like <code>PSObject</code>, but better. Among other improvements (e.g. property order being preserved), creating object from hashtable is simplified:</p>

<pre><code>[PSCustomObject]@{one=1; two=2;}
</code></pre>

<p>Now it seems obvious that this statement:</p>

<pre><code>[System.Management.Automation.PSCustomObject]@{one=1; two=2;}
</code></pre>

<p>would work the same way, because <code>PSCustomObject</code> is an "alias" for full namespace + class name. Instead I get an error:</p>

<blockquote>
  <p>Cannot convert the "System.Collections.Hashtable" value of type "System.Collections.Hashtable" to type "System.Management.Automation.PSCustomObject".</p>
</blockquote>

<p>I listed accelerators for both types of objects:</p>

<pre><code>[accelerators]::get.GetEnumerator() | where key -Like ps*object

    Key            Value
    ---            -----
    psobject       System.Management.Automation.PSObject
    pscustomobject System.Management.Automation.PSObject
</code></pre>

<p>and discovered that both reference the same <code>PSObject</code> class - this has to mean that using accelerators can do a bunch of other stuff than just making the code shorter.</p>

<p>My questions regarding this issue are:</p>

<ol>
<li>Do you have some interesting examaples of differences between using an accelerator vs using full type name?</li>
<li>Should using full type name be avoided whenever an accelerator is available as a general best practice?</li>
<li>How to check, maybe using reflection, if an accelerator does other stuff than just pointing to underlying class?</li>
</ol>