Creating arrays and hashtables

Refer to the following table:

Using the array operator

@()
$array = @()    # Empty array
$array = @(1, 2, 3, 4)

Implicit array

Value1, Value2, Value3
$array = 1, 2, 3, 4
$array = “one”, “two”, “three”, “four”

Using the hashtable operator

@{}
$hashtable = @{}    # Empty hashtable
$hashtable = @{Key1 = “Value1”}
$hashtable = @{Key1 = “Value1”; Key2 = “Value2”}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset