Chapter 8. DLLs, Types, Properties, Methods, and Microsoft Roslyn
How do you learn to work with PowerShell, the .NET Framework, your .NET DLLs, third-party .NET DLLs, and other Microsoft and non-Microsoft libraries? In this chapter, Iâll step you through how to load DLLs and discover the types, properties, and methods that you can call during a live interactive session.
Note
When youâre working with the .NET Framework, your best friend is the MSDN Library (http://msdn.microsoft.com/en-us/library/). Itâs an essential source of information for developers using Microsoft tools, products, technologies, and services.
For example, if I search for âprogrammatically put data on the clipboard MSDN,â I find the page âClipboard Class (System.Windows)â (http://bit.ly/GJuNcS). This page details all the information I needâspecifically the assembly needed to load (PresentationCore
), the fully qualified type name (namespace and class) needed to call System.Windows.Clipboard
, and a list of the methods that are available to use.
Sending Text to the Clipboard
To kick this section off, weâll create a PowerShell function to put the text âHello Worldâ on the clipboard. Iâll show you how to use Get-Member
to list out method names at the command line so you can discover them in your current session. This is a convenient technique that can speed development when you need to find out what methods exist on an object you are using.
Note
For this example, if you are using PowerShell v2 youâll ...
Get Windows PowerShell for Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.