Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check hash table contains value or not

I use PowerShell to execute SQL query to get computer process id and return hash tale below:

$processId
5068
6176
7240
7632

Now, I use: $processId -contains 5068 to check this value exist in $processId or not.

My expected is true but it return false.

I don't know why. Welcome all answer.

Result $processId | Get-Member:

like image 920
ndt Avatar asked Mar 07 '23 11:03

ndt


1 Answers

On a hashtable, you can check for existing items using the ContainsKey() method. For example:

$processId.ContainsKey(5068)
like image 200
boxdog Avatar answered Mar 16 '23 09:03

boxdog