Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Windows PowerShell for .NET Developers - Second Edition

You're reading from   Windows PowerShell for .NET Developers - Second Edition Efficiently administer and maintain your development environment with Windows PowerShell

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781785287435
Length 330 pages
Edition 2nd Edition
Arrow right icon
Toc

Exploring API using PowerShell


We considered a basic example of using the Windows API. There are different ways to use APIs in PowerShell based on the requirements. Windows PowerShell has the feature of interacting with .NET DLL files as well. Let's consider that you have a code that simply performs addition operations that we can load in PowerShell and then explores the methods. But why are we discussing DLL now? Here is a comparison of API and DLL:

API

DLL

Abstract

Concrete

In this, the interface is implemented by the software program

This is a method of providing APIs

An API is an interface to the library of code

DLL is nothing but a library of code

In short, DLL is a file format and a way to use API.

Let's take a look at a demo where we will use a custom DLL file in Windows PowerShell. For this, we will choose a class library in Visual C# and build a code that will simply add two given integers.

The C# code is as follows:

using System;
using System.Collections.Generic;
using System...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image