Non-public classes

.NET classes come with a number of access modifiers. Each of these affords a different level of protection and visibility.

Instances of a public class may be created using New-Object (with an appropriate list of arguments), or the new static method via the constructors, as shown previously.

Private and internal (non-public) classes are not directly accessible; they are placed out of sight by the developer of the class. They are often part of an implementation of a program or command and are not expected to be directly accessed.

In some cases, the decision to hide something away appears to be counterproductive. One example of this is the TypeAccelerators class.

The type derived from the class may be accessed using the following notation:

PS> [System.Management.Automation.PowerShell].Assembly.GetType(
'System.Management.Automation.TypeAccelerators')

IsPublic IsSerial Name BaseType
-------- -------- ---- --------
False False TypeAccelerators System.Object
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.22.164