Examining .NET classes
With .NET, a class defines an object. Objects and object occurrences are fundamental to PowerShell, where cmdlets produce and consume objects. For example, the Get-Process
command returns objects of the class System.Diagnostics.Process
. If you use Get-ChildItem
to return files and folders, the output is a set of objects based on the System.IO.FileInfo
and System.IO.DirectoryInfo
classes.
In most cases, your console activities and scripts make use of the objects created automatically by PowerShell commands. But you can also use the New-Object
command to create occurrences of any class as necessary. This book shows numerous examples of creating an object using New-Object
.
Within .NET, you have two kinds of object definitions: .NET classes and .NET types. A type defines a simple object that lives, at runtime, on your CPU's stack. Classes, being more complex, live in the global heap. The global heap is a large area of memory which .NET uses to hold...