I am creating an array of string objects in PowerShell which needs to be passed into an Xceed zip library method which expects a string[], but I get an error everytime. It makes me wonder if the PowerShell array is something other than a .NET array. Here is some code:
$string_list = @()
foreach($f in $file_list)
{
$string_list += $f.FullName
}
[Xceed.Zip.QuickZip]::Zip("C:\new.zip", $true, $false, $false, $string_list)
The error I get says "An error occurred while adding files to the zip file." If I hard code in values like this it works:
[Xceed.Zip.QuickZip]::Zip("C:\new.zip", $true, $false, $false, "test.txt", "test2.txt", "test3.txt")
Can someone help me figure this out? I can't understand what the difference would be...
EDIT: I have tested and confirmed that my $string_list array is composed of System.String objects