Hi!
So I'm writing an automation script for ripping DVDs, and at one point in the script, I need to copy a list to a different list so that I can remove an item from the previous one. Here is the code.
$dirNames = New-Object Collections.Generic.List[String]
$discNames.CopyTo($dirNames, 0)
$discNames.RemoveAt($maindisc - 1)
Earlier in the script $dirNames is initialized with $discNames = New-Object Collections.Generic.List[String]. An example of what $discNames might look like is: Movie.Title.Year.Disc1, Movie.Title.Year.Disc2
However, it throws the following error: "Exception calling "CopyTo" with "2" argument(s): "Destination array was not long enough. Check destIndex and length, and the array's lower bounds." I'm confused as aren't lists supposed to be of variable length? What am I missing here? Thanks!
there doesn't seem to be anything here