AftabHussain

arrays

May 20th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. PS C:\> Function Test-Array {
  2.  
  3. Param (
  4. [parameter(Mandatory=$true)]
  5. [ValidateSet('a','b')]
  6. [System.Collections.ArrayList]$Letters = @()
  7. )
  8. $letters
  9. }
  10.  
  11. Test-Array -Letters a
  12.  
  13. Test-Array : Cannot process argument transformation on parameter 'Letters'. Cannot convert the "a" value of type
  14. "System.String" to type "System.Collections.ArrayList".
  15. At line:11 char:21
  16. + Test-Array -Letters a
  17. + ~
  18. + CategoryInfo : InvalidData: (:) [Test-Array], ParameterBindingArgumentTransformationException
  19. + FullyQualifiedErrorId : ParameterArgumentTransformationError,Test-Array
Advertisement
Add Comment
Please, Sign In to add comment