I have an interesting problem for a while. Let them say that I have a function
function GetAllFiles($creds, $fld){
$newFiles = New-Object "system.collections.generic.list[string]"
... other stuff which adds entires
return $newFiles
}
On the call side when I perform
$files = GetAllFiles $creds $fld
$files.Remove("AnExistingEntry")
I get
dir-ls.ps1: the method call failed because [System.Object []] does not contain an od method named Delete.
When I $ NewFiles.GetType ()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
How can I do this "system.collections.generic.list [string]" back?
thank
source
share