Created
March 12, 2015 20:24
-
-
Save barbeque/44a00a1bbaa02509b961 to your computer and use it in GitHub Desktop.
Defining custom object and passing it into powershell functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function NewSteak() { | |
$steak = New-Object PSObject | |
$steak | Add-Member -type NoteProperty -Name Doneness -Value "Rare" | |
$steak | Add-Member -type NoteProperty -Name Juiciness -Value "Low" | |
return $steak | |
} | |
function AuditSteak([PSObject]$steak) { | |
Write-Host "The steak is" $steak.Doneness | |
} | |
$steak = NewSteak | |
AuditSteak($steak) |
If that's the 'old' way, what is the new way?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an old way to create object