Skip to content

Instantly share code, notes, and snippets.

@NonSecwitter
Created February 24, 2017 19:35
Show Gist options
  • Save NonSecwitter/52a850ef6a51fe73dfe69face59827fe to your computer and use it in GitHub Desktop.
Save NonSecwitter/52a850ef6a51fe73dfe69face59827fe to your computer and use it in GitHub Desktop.
Function Swap-Elements
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory=$true, Position=0)]
[ref]$Array,
[Parameter(Mandatory=$true, Position=1)]
$IndexOne,
[Parameter(Mandatory=$true, Position=2)]
$IndexTwo
)
$temp = $Array[$IndexOne]
$Array[$IndexOne] = $Array[$IndexTwo]
$Array[$IndexTwo] = $temp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment