Advertisement
Dennisaa

PsObjectArray01

Jan 1st, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $w = New-Object -TypeName PSCustomObject -Property @{numcol = [int] 13; stringCol = "the original"}
  2. $w | Get-Member
  3. $w
  4. $x = New-Object -TypeName System.Management.Automation.PSCustomObject -Property @{numcol = [int] 22; stringCol = "something"}
  5. $x | Get-Member
  6. $x
  7. $y = New-Object -TypeName PSObject -Property @{numcol = [int] 42; stringCol = "something additional"}
  8. $y | Get-Member
  9. $y.GetType().ToString()
  10.  
  11. $z = @()
  12.  
  13. $z += $w
  14. $z += $x
  15. $z += $y
  16.  
  17. $z[0]
  18.  
  19. $z.GetType().ToString()
  20.  
  21. $z[1] | Get-Member
  22.  
  23. $z | % { $_.stringCol }
  24.  
  25. $sum = 0
  26. $concattedString = ""
  27.  
  28. $z | % { $sum += $_.numCol; $concattedString += "[$($_.stringCol)]" }
  29.  
  30. $sum
  31. $concattedString
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement