Comparison of programming languages (associative array): Difference between revisions

Content deleted Content added
Visual Basic .NET: copy editing
Windows PowerShell: copy editing
Line 1,926:
</syntaxhighlight>
 
=== [[Windows PowerShell]] ===
Unlike many other [[command line interpreter]]s, [[Windows PowerShell]] has built-in, language-level support for defining associative arrays.:
 
For example:
 
<syntaxhighlight lang=PowerShell>
Line 1,939 ⟶ 1,937:
</syntaxhighlight>
 
LikeAs in JavaScript, if the property name is a valid identifier, the quotes can be omitted, e.g.:
 
<syntaxhighlight lang=PowerShell>
Line 1,945 ⟶ 1,943:
</syntaxhighlight>
 
Entries can be separated by either a semicolon or a newline, e.g.:
 
<syntaxhighlight lang=PowerShell>
Line 1,954 ⟶ 1,952:
</syntaxhighlight>
 
Keys and values can be any [[.NET Framework|.NET]] object type, e.g.:
 
<syntaxhighlight lang=PowerShell>
Line 1,965 ⟶ 1,963:
</syntaxhighlight>
 
It is also possible to create an empty associative array and add single entries, or even other associative arrays, to it later on.:
 
<syntaxhighlight lang=PowerShell>
Line 1,973 ⟶ 1,971:
</syntaxhighlight>
 
New entries can also be added by using the array index operator, the property operator, or the <code>Add()</code> method of the underlying .NET object:
 
<syntaxhighlight lang=PowerShell>
Line 1,982 ⟶ 1,980:
</syntaxhighlight>
 
To dereference assigned objects, the array index operator, the property operator, or the parameterized property <code>Item()</code> of the .NET object can be used:
 
<syntaxhighlight lang=PowerShell>
Line 2,002 ⟶ 2,000:
</syntaxhighlight>
 
Hash tables can be added, e.g.:
 
<syntaxhighlight lang=PowerShell>