How it works...
Type accelerators are another form of encapsulation of .NET code in PowerShell. Recall the first recipe in this chapter, wherein we created a .NET object within PowerShell. We used the PowerShell command New-Object -TypeName System.IO.DirectoryInfo -ArgumentList '/home/ram' to get information on a home directory: we created a new instance of System.IO.DirectoryInfo and passed an argument to it. That was a lot of code to write. To accelerate this process, we could use [IO.DirectoryInfo]'/home/ram' (System is the default namespace; PowerShell will understand it without us explicitly mentioning it when calling accelerators), which outputs the same object as the former command.
With Import-Csv, on the other hand, the process is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access