powershell 有关联数组吗? [英] Does powershell have associative arrays?
本文介绍了powershell 有关联数组吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个返回 id、name 对的函数.
I am writing a function that returns an id, name pair.
我想做类似的事情
$a = get-name-id-pair()
$a.Id
$a.Name
like 在 javascript 中是可能的.或者至少
like is possible in javascript. Or at least
$a = get-name-id-pair()
$a["id"]
$a["name"]
like 在 php 中是可能的.我可以用 powershell 做到这一点吗?
like is possible in php. Can I do that with powershell?
推荐答案
也
$a = @{'foo'='bar'}
或
$a = @{}
$a.foo = 'bar'
这篇关于powershell 有关联数组吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文