How to create a char array of length $Count in powershell?
PS C:\Users\Administrator> $Count
415
PS C:\Users\Administrator> $chars = New-Object System.Char ($Count)
New-Object : Constructor not found. Cannot find an appropriate constructor for type System.Char.
At line:1 char:10
+ $chars = New-Object System.Char ($Count)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand
I tried
[Char[]] $chars = @(415)
I had a class which needed a char array, but I basically I found a solution to my problem by using Strings. But I just wanted to ask if any one knows how to create an empty char array of variable length.
Eg: How do I do this in powershell? C# -> var chars = new Char[Count];