34,333
edits
Changes
no edit summary
== Adding Elements to a Windows PowerShell Hashtable ==
New elements may be added to a hashtable using both object property and array acessor accessor notation together with the new key and value pair. To add ''publisher'' and ''price'' elements to our ''$book'' hashtable, therefore, the following commands may be used:
<pre>
== Clearing All Elements from a Windows PowerShell Hashtable ==
In the event that all elements are to be removed from a Windows PowerShell hashtable, an a fast alternative to removing each element one by one is to the use the ''clear()'' method as demonstrated below:
<pre>
Elements in two or more hashtables may be combined using a variety of techniques. One important point to note is that the combination can only be performed by PowerShell if there are no duplicated keys in the hashtables. If duplicate keys are found the operation will fail.
The elements in one hashtable may be added to those in another hashtable using the += operator. In the following example, the elements in ''$book2'' are added to ''$book1'':
<pre>
The Power of Widgets
</pre>
<google>BUY_WPS_BOTTOM</google>