Chapter4: Common Type

This section contain the following items:

  • 1.Array List and Operation

  • 2.Array

1.Array List and Operation

  • 1.Create an ArrayList and add/delete items

    • add/delete items

        $countries = New-Object System.Collections.ArrayList
        $countries.Add('India')
        $countries.Add('Taiwan')
    • delete items

        $countries.Remove('Taiwan')
    • delete all items $countries.Clear()

  • 2.Traversal

      for($i=0; $i -lt $countries.Count; $i++)
      {
          $countries[$i]
      }

2.Array

  • 1.Create a empty array

      $myArray = @()
  • 2.Add Elements to array

      $myArray += 1

Last updated

Was this helpful?