System.String変数のインスタンスを削除するにはどうすればよいですか?
$ Servers = "server"、 "localhost"
ローカルホストを削除したいのですが、何かアイデアはありますか?
System.String変数のインスタンスを削除するにはどうすればよいですか?
$ Servers = "server"、 "localhost"
ローカルホストを削除したいのですが、何かアイデアはありますか?
You can set to $null
the Array entry (you must know the index):
$Servers.Set(1, $NULL)
If you need a return value of [string]
not an [objtect[]]
[string]$Servers = $Servers[0] # need always knowing the indexs
If the Array count > 2 you need to do:
$Servers = $servers | ? { $_ -ne "localhost" }
or in short way
$servers = $servers -ne "localhost"
Or you can cast to ArrayList
:
[System.Collections.ArrayList]$servers = $servers
$servers.Remove("localhost")