I can think of other ways but a simple one could be this
$A = "A","B","C"
$B = "X","Y","Z"
$C = "X"
$AllArrays = @{'A'=$A;'B'=$B}
$AllArrays.GetEnumerator() | ForEach-Object{
If($_.Value -contains $C){
Write-Host "Found In $($_.Name)"
}
}
You could build a hash table of all your arrays and then loop through it. Each .Value of the hash table contains one of the arrays. You still use -contains and report back the name of the array from the original hash table. We use the GetEnumerator method which effectively sends each entry in the hash table across the pipeline as a separate object. FYI if your arrays are not statically assigned you could build the hash table with something like $AllArrays.Add('D',$D)
Found In B
The B comes from 'B'=$B in the hash table. This all depends on how you declare your arrays. There might be cleaner ways depending on how your arrays are populated.
Alternative
Instead of a hashtable you could use a PsCustomObject. Note this code was designed in PowerShell 3.0 but minor changes will make it work in earlier versions. In this snippet I removed the array declarations for brevity.
$allArrays = [PsCustomObject]@{
'A'=$A
'B'=$B
}
$allArrays.psobject.Properties | ForEach-Object{
If($_.Value -contains $C){
Write-Host "Found In $($_.Name)"
}
}