1

Topic: Powershell: hash tables under the link

Hello, respected!
I can not understand how to work with , transferred in function under the link

function Test ([ref] $hash) {
$hash.value
}
$T = {"a" =1; "b" =2}
Test-hash ([ref] $T)

Works, certainly
And here, let us assume, it is necessary to add pair "key-value", and here already
Prompt, and?

2

Re: Powershell: hash tables under the link

function getData
{
param ([hashtable] $data)
$data ["A"] = 123
}
$data = {}
getData $data
$data

3

Re: Powershell: hash tables under the link

Alexey To, that is under the link not to transfer the hash table?

4

Re: Powershell: hash tables under the link

funddd wrote:

Alexey To, that is under the link the hash table not to transfer?

the Hash table is a reference type. It is always transferred under the link.

5

Re: Powershell: hash tables under the link

funddd wrote:

And here, let us assume, it is necessary to add pair "key-value", and here already
Prompt, and?

Type {} | gm and receive the list of methods.
[ref] it is not necessary, as  it is reference type