我嘗試使用PowerShell腳本來找到一個ArrayList的元素的索引,但得到如下錯誤如何找到元素的indexOf ArrayList中在PowerShell中
方法調用失敗,因爲[System.String []]不包含名爲'IndexOf'的 方法。
代碼中使用:
[String[]]$eventList = New-Object System.Collections.ArrayList
$eventList.GetType().FullName
$index = $eventList.IndexOf('cvv');
什麼我在這種情況下的'cvv'? –
不幸的是,我不認爲powershell數組支持'IndexOf'。 – lurker
'cvv'是一個字符串,我試圖找到$ eventList這是null事情是我想'cvv'在$ eventList中的位置null它應該返回'-1'但它返回錯誤 –