Selected .NET Classes, and Their Uses

This appendix provides pointers to classes in the .NET Framework that provide useful functionality in addition to what PowerShell provides. For detailed descriptions and documentation, search the official documentation at http://msdn.microsoft.com.

Windows PowerShell

Class

Description

System.Management.Automation.PSObject

Represents a PowerShell object to which you can add notes, properties, and more.

Utility

Class

Description

System.DateTime

Represents an instant in time, typically expressed as a date and time of day.

System.Guid

Represents a globally unique identifier (GUID).

System.Math

Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.

System.Random

Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet certain statistical requirements for randomness.

System.Convert

Converts a base datatype to another base datatype.

System.Environment

Provides information about, and means to manipulate, the current environment and platform. This class cannot be inherited.

System.Console

Represents the standard input, output, and error streams for console applications. This class cannot be inherited.

System.Text.RegularExpressions.Regex

Represents an immutable regular expression.

System.Diagnostics.Debug

Provides a set of methods and properties that help debug your code. This class cannot be inherited.

System.Diagnostics.EventLog

Provides interaction with Windows event logs.

System.Diagnostics.Process

Provides access to local and remote processes and enables you to start and stop local system processes.

System.Diagnostics.Stopwatch

Provides a set of methods and properties that you can use to accurately measure elapsed time.

System.Media.SoundPlayer

Controls playback of a sound from a .wav file.

Collections and Object Utilities

Class

Description

System.Array

Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.

System.Enum

Provides the base class for enumerations.

System.String

Represents text as a series of Unicode characters.

System.Text.StringBuilder

Represents a mutable string of characters. This class cannot be inherited.

System.Collections.Specialized.OrderedDictionary

Represents a collection of key/value pairs that are accessible by the key or index.

System.Collections.ArrayList

Implements the IList interface using an array whose size is dynamically increased as required.

The .NET Framework

Class

Description

System.AppDomain

Represents an application domain, which is an isolated environment where applications execute. This class cannot be inherited.

System.Reflection.Assembly

Defines an Assembly, which is a reusable, versionable, and self-describing building block of a common language runtime application.

System.Type

Represents type declarations: class types, interface types, array types, value types, enumeration types, type parameters, generic type definitions, and open or closed constructed generic types.

System.Threading.Thread

Creates and controls a thread, sets its priority, and gets its status.

System.Runtime.InteropServices.Marshal

Provides a collection of methods for allocating unmanaged memory, copying unmanaged memory blocks, and converting managed to unmanaged types, as well as other miscellaneous methods used when interacting with unmanaged code.

Microsoft.CSharp.CSharpCodeProvider

Provides access to instances of the C# code generator and code compiler.

Registry

Class

Description

Microsoft.Win32.Registry

Provides RegistryKey objects that represent the root keys in the Windows registry, and static methods to access key/value pairs.

Microsoft.Win32.RegistryKey

Represents a key-level node in the Windows registry. This class is a registry encapsulation.

Input and Output

Class

Description

System.IO.Stream

Provides a generic view of a sequence of bytes.

System.IO.BinaryReader

Reads primitive datatypes as binary values in a specific encoding.

System.IO.BinaryWriter

Writes primitive types in binary to a stream and supports writing strings in a specific encoding.

System.IO.BufferedStream

Adds a buffering layer to read and write operations on another stream. This class cannot be inherited.

System.IO.Directory

Exposes static methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.

System.IO.FileSystemInfo

Provides the base class for both FileInfo and DirectoryInfo objects.

System.IO.DirectoryInfo

Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.

System.IO.File

Provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of FileStream objects.

System.IO.MemoryStream

Creates a stream whose backing store is memory.

System.IO.Path

Performs operations on String instances that contain file or directory path information. These operations are performed in a cross-platform manner.

System.IO.TextReader

Represents a reader that can read a sequential series of characters.

System.IO.StreamReader

Implements a TextReader that reads characters from a byte stream in a particular encoding.

System.IO.TextWriter

Represents a writer that can write a sequential series of characters. This class is abstract.

System.IO.StreamWriter

Implements a TextWriter for writing characters to a stream in a particular encoding.

System.IO.StringReader

Implements a TextReader that reads from a string.

System.IO.StringWriter

Implements a TextWriter for writing information to a string. The information is stored in an underlying StringBuilder.

System.IO.Compression.DeflateStream

Provides methods and properties for compressing and decompressing streams using the Deflate algorithm.

System.IO.Compression.GZipStream

Provides methods and properties used to compress and decompress streams.

System.IO.FileSystemWatcher

Listens to the filesystem change notifications and raises events when a directory, or file in a directory, changes.

Security

Class

Description

System.Security.Principal.WindowsIdentity

Represents a Windows user.

System.Security.Principal.WindowsPrincipal

Allows code to check the Windows group membership of a Windows user.

System.Security.Principal.WellKnownSidType

Defines a set of commonly used security identifiers (SIDs).

System.Security.Principal.WindowsBuiltInRole

Specifies common roles to be used with IsInRole.

System.Security.SecureString

Represents text that should be kept confidential. The text is encrypted for privacy when being used, and deleted from computer memory when no longer needed. This class cannot be inherited.

System.Security.Cryptography.TripleDESCryptoServiceProvider

Defines a wrapper object to access the cryptographic service provider (CSP) version of the TripleDES algorithm. This class cannot be inherited.

System.Security.Cryptography.PasswordDeriveBytes

Derives a key from a password using an extension of the PBKDF1 algorithm.

System.Security.Cryptography.SHA1

Computes the SHA1 hash for the input data.

System.Security.AccessControl.FileSystemSecurity

Represents the access control and audit security for a file or directory.

System.Security.AccessControl.RegistrySecurity

Represents the Windows access control security for a registry key. This class cannot be inherited.

User Interface

Class

Description

System.Windows.Forms.Form

Represents a window or dialog box that makes up an application’s user interface.

System.Windows.Forms.FlowLayoutPanel

Represents a panel that dynamically lays out its contents horizontally or vertically.

Image Manipulation

Class

Description

System.Drawing.Image

An abstract base class that provides functionality for the Bitmap and Metafile descended classes.

System.Drawing.Bitmap

Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes. A bitmap is an object used to work with images defined by pixel data.

Networking

Class

Description

System.Uri

Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.

System.Net.NetworkCredential

Provides credentials for password-based authentication schemes such as basic, digest, NTLM, and Kerberos authentication.

System.Net.Dns

Provides simple domain name resolution functionality.

System.Net.FtpWebRequest

Implements a File Transfer Protocol (FTP) client.

System.Net.HttpWebRequest

Provides an HTTP-specific implementation of the WebRequest class.

System.Net.WebClient

Provides common methods for sending data to and receiving data from a resource identified by a URI.

System.Net.Sockets.TcpClient

Provides client connections for TCP network services.

System.Net.Mail.MailAddress

Represents the address of an electronic mail sender or recipient.

System.Net.Mail.MailMessage

Represents an email message that can be sent using the SmtpClient class.

System.Net.Mail.SmtpClient

Allows applications to send e-mail by using the Simple Mail Transfer Protocol (SMTP).

System.IO.Ports.SerialPort

Represents a serial port resource.

System.Web.HttpUtility

Provides methods for encoding and decoding URLs when processing Web requests. This class cannot be inherited.

XML

Class

Description

System.Xml.XmlTextWriter

Represents a writer that provides a fast, non-cached, forward-only way of generating streams or files containing XML data that conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.

System.Xml.XmlDocument

Represents an XML document.

Windows Management Instrumentation (WMI)

Class

Description

System.Management.ManagementObject

Represents a WMI instance.

System.Management.ManagementClass

Represents a Common Information Model (CIM) management class. A management class is a WMI class such as Win32_LogicalDisk, which can represent a disk drive, and Win32_Process, which represents a process such as Notepad.exe. The members of this class enable you to access WMI data using a specific WMI class path. For more information, see “Win32 Classes” in the Windows Management Instrumentation documentation in the MSDN Library at http://msdn.microsoft.com/library.

System.Management.ManagementObjectSearcher

Retrieves a collection of management objects based on a specified query. This class is one of the more commonly used entry points to retrieving management information. For example, it can be used to enumerate all disk drives, network adapters, processes and many more management objects on a system, or to query for all network connections that are up, services that are paused, and so on. When instantiated, an instance of this class takes as input a WMI query represented in an ObjectQuery or its derivatives, and optionally a ManagementScope representing the WMI namespace to execute the query in. It can also take additional advanced options in an EnumerationOptions. When the Get method on this object is invoked, the ManagementObjectSearcher executes the given query in the specified scope and returns a collection of management objects that match the query in a ManagementObjectCollection.

System.Management.ManagementDateTimeConverter

Provides methods to convert DMTF datetime and time intervals to CLR-compliant DateTime and TimeSpan format and vice versa.

System.Management.ManagementEventWatcher

Subscribes to temporary event notifications based on a specified event query.

Active Directory

Class

Description

System.DirectoryServices.DirectorySearcher

Performs queries against Active Directory.

System.DirectoryServices.DirectoryEntry

The DirectoryEntry class encapsulates a node or object in the Active Directory hierarchy.

Database

Class

Description

System.Data.DataSet

Represents an in-memory cache of data.

System.Data.DataTable

Represents one table of in-memory data.

System.Data.SqlClient.SqlCommand

Represents a Transact-SQL statement or stored procedure to execute against a SQL Server database. This class cannot be inherited.

System.Data.SqlClient.SqlConnection

Represents an open connection to a SQL Server database. This class cannot be inherited.

System.Data.SqlClient.SqlDataAdapter

Represents a set of data commands and a database connection that are used to fill the DataSet and update a SQL server database. This class cannot be inherited.

System.Data.Odbc.OdbcCommand

Represents an SQL statement or stored procedure to execute against a data source. This class cannot be inherited.

System.Data.Odbc.OdbcConnection

Represents an open connection to a data source.

System.Data.Odbc.OdbcDataAdapter

Represents a set of data commands and a connection to a data source that are used to fill the DataSet and update the data source. This class cannot be inherited.

Message Queuing

Class

Description

System.Messaging.MessageQueue

Provides access to a queue on a Message Queuing server.

Transactions

Class

Description

System.Transactions.Transaction

Represents a transaction.

..................Content has been hidden....................

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