Reputation: 826
if i try to
$g = [System.Collections.Generic.List[char[]]]@()
$g.AddRange([char[]]@('1','2'))
i get this
Cannot convert argument "collection", with value: "System.Char[]", for "AddRange" to type "System.Collections.Generic.IEnumerable`1[System.Char[]]"
Upvotes: 0
Views: 123
Reputation: 5566
Lets break it down:
Cannot convert argument "collection"
The compiler can't convert between one type and another for the parameter called "collection"
with value: "System.Char[]"
Means you are passing a Char Array (System.Char[]
)
for "AddRange"
You are passing the Char Array to the AddRange method.
to type "System.Collections.Generic.IEnumerable`1[System.Char[]]"
AddRange is expecting an IEnumerable (e.g. List or array) of Char Arrays
So, cant convert from Char Array to an Array/List of Char Arrays
So either:
Upvotes: 1