Working with .NET

PowerShell is written in and built on the .NET Framework. Much of the .NET Framework can be used directly, and doing so adds a tremendous amount of flexibility; it removes many of the borders the language might otherwise have.

The idea of working with objects was introduced in Chapter 4, Working with Objects in Powershell, and this chapter extends on that, moving from objects created by commands to objects created from .NET classes. Many of the chapters which follow make extensive use of .NET, simply because it is the foundation of PowerShell.

It is important to understand that the .NET Framework is vast; it is not possible to cover everything about the .NET Framework in a single chapter. This chapter aims to show how the .NET Framework may be used within PowerShell based on the MSDN reference.

What can you do with .NET?
What would you like to do?
I enjoy implementing network protocols in PowerShell. To do this, I use several branches of .NET which specialize in network operations, such as creating sockets, sending and receiving bytes, reading and converting streams of bytes, and so on.
Classes implemented in .NET will come up again and again as different areas of the language are explored. From building strings and working with Active Directory to writing graphical interfaces and working with web services, everything needs a little .NET.

In this chapter, we are going to cover the following topics:

  • Assemblies
  • Namespaces
  • Types
  • Classes
  • Constructors
  • Properties and methods
  • Static properties
  • Static methods
  • Non-public classes
  • Type accelerators
  • Using keyword
..................Content has been hidden....................

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