Hallo zusammen,
ich möchte Werte aus einem Array löschen. Hierbei möchte ich die Wahl haben, ob die zu löschenden Werte über eine Variable oder z.B. von 0-2 angegeben werden.
Da man anscheinend nicht aus einem Array löschen darf, da es eine feste Größe hat, habe ich das hier versucht:
geht:
[System.Collections.ArrayList]$ArrayAll = 'Comp01', 'Comp02', 'Comp03', 'Comp04', 'Comp05', 'Comp06', 'Comp07', 'Comp08', 'Comp09', 'Comp10', 'Comp11', 'Comp12' [System.Collections.ArrayList]$ToDelete1 = 'Comp01', 'Comp02', 'Comp03' $ArrayAll.RemoveAt($ArrayAll.IndexOf("Comp01"))
geht nicht:
[System.Collections.ArrayList]$ArrayAll = 'Comp01', 'Comp02', 'Comp03', 'Comp04', 'Comp05', 'Comp06', 'Comp07', 'Comp08', 'Comp09', 'Comp10', 'Comp11', 'Comp12' [System.Collections.ArrayList]$ToDelete1 = 'Comp01', 'Comp02', 'Comp03' $ArrayAll.RemoveAt($ArrayAll.IndexOf("$ToDelete1"))
geht auch nicht:
[System.Collections.ArrayList]$ArrayAll = 'Comp01', 'Comp02', 'Comp03', 'Comp04', 'Comp05', 'Comp06', 'Comp07', 'Comp08', 'Comp09', 'Comp10', 'Comp11', 'Comp12' [System.Collections.ArrayList]$ToDelete1 = 'Comp01', 'Comp02', 'Comp03' $ArrayAll.RemoveAt($ArrayAll.IndexOf("[0..2]"))
Schonmal vielen dank für euren Input!
Sönke