# encoding: ascii
# api: powershell
# title: Invoke-Inline.ps1
# description: From Windows PowerShell Cookbook (O’Reilly) by Lee Holmes
# version: 0.1
# author: Lee Holmes
# license: CC0
# x-poshcode-id: 2180
# x-archived: 2016-03-19T00:32:32
# x-published: 2011-09-09T21:41:00
#
#
#############################################################################
##
## Invoke-Inline
##
## From Windows PowerShell Cookbook (O'Reilly)
## by Lee Holmes (http://www.leeholmes.com/guide)
##
#############################################################################
<#
.SYNOPSIS
Demonstrates the Add-Type cmdlet to invoke in-line C#
#>
Set-StrictMode -Version Latest
$inlineType = Add-Type -Name InvokeInline_Inline -PassThru `
-MemberDefinition @'
public static int RightShift(int original, int places)
{
return original >> places;
}
'@
$inlineType::RightShift(1024, 3)