主阵列中有6个阵列。 我查看6个数组中的每个数组以搜索值。 当我找到值时,我想返回在其中找到的数组的名称?
#this is a basic extract to simplify what i am trying to get i am sure its
#staring me in the face i just cannot work it out.
$Restaurants = @($PacRests, $CenRests, $MountRests, $HIRests, $ERests,
$AtRests)
ForEach ($Restaurant in $Restaurants)
{ #this will return the entire contents of $Restuarant Array in a list
Write-output $restaurant
ForEach ($R in $Restaurant)
{ #this will return the actual single value inside the
$restaurant Array
Write-output $R
#What i need is the name of the Array the $R was found in.
#so $R.parentvalue but that does not work.
#so lets say $R is found inside $cenRests i need to identify that
}
}