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."
}

沒有留言:

軟體工程的重要的指標