![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | The easiest way to create an empty data structure I have discovered how to create an empty data structure very easily and yet effectively. ----- 8< ----- # I guess this way is standard and verbose function MyObject1 { $e = New-Object PSObject $e | Add-Member NoteProperty p1 $null $e | Add-Member NoteProperty p2 $null $e | Add-Member NoteProperty p3 $null $e } # I guess this way is not standard and brief function MyObject2 { 1 | Select-Object p1, p2, p3 } # The results are the same MyObject1 | gm MyObject2 | gm # The brief not standard way looks even more effective Measure-Command {1..111 | % {MyObject1}} Measure-Command {1..111 | % {MyObject2}} ----- 8< ----- LOL -- Thanks, Roman |
My System Specs![]() |
| | #2 (permalink) |
| | RE: The easiest way to create an empty data structure Terminology: I think “a custom object with null properties” is more correct than “an empty data structure”. -- Thanks, Roman |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| VB 2005 Windows forms Data Structure | .NET General | |||
| re-create user folder structure | Vista account administration | |||
| Extract data out of a seemingly complex structure | .NET General | |||
| Zip extract is empty directory structure | Vista file management | |||
| Create a folder structure | Vista file management | |||