
上QQ阅读APP看书,第一时间看更新
How it works…
Note the very first line of the output, TypeName: System.IO.DirectoryInfo. That is the exact type name we used when we created the .NET object:

This proves that the same task of showing information on the current working directory can be achieved by either calling a .NET constructor or by running a PowerShell cmdlet, the implication being that PowerShell cmdlets are simply encapsulated .NET code. In essence, Get-Item calls the System.IO.DirectoryInfo class under the hood, with the arguments passed along with the cmdlet.
Like they say: "If the C# guys can do it, so can you."