2010/07/07

PowerShell Array

宣告:

[array]$tmpary= @()

Add Array:

$tmpary+= "a"
$tmpary+= "b"
$tmpary+= "c"

Get Array:

if ($ary.Count -gt 0)
{
foreach ($element in $ary)
{
echo $element
}
}

Array Contains & Notcontains:

if ($tempary -contains "a")
{
echo "a exists."
}

if ($tempary -notcontains "d")
{
echo "d not exists."
}

T-SQL 語法風格