Powershell [array]调用地址方法中的奇怪行为

Powershell [array]调用地址方法中的奇怪行为,powershell,Powershell,我已经在Powershell 2.0中的Win XP和Windows Server 2008 R2上对此进行了测试: $a = 1,2,3,4 # a simple [object[]] but any other Type is good 如果我这样做: $a.addres() 返回错误为(正确): 方法调用失败,因为[System.Object[]不包含名为“addres”的方法。 但如果我这样做: $a.address() 错误是: 找不到“地址”和参数计数的重载:“0”。 但是做:

我已经在Powershell 2.0中的Win XP和Windows Server 2008 R2上对此进行了测试:

$a = 1,2,3,4 # a simple [object[]] but any other Type is good
如果我这样做:

$a.addres()
返回错误为(正确):

方法调用失败,因为[System.Object[]不包含名为“addres”的方法。

但如果我这样做:

$a.address()
错误是:

找不到“地址”和参数计数的重载:“0”。

但是做:

$a.address(2)
使用“问题事件名称:APPCRASH”关闭powershell控制台


从这一点开始,
[system.array]
没有名为
address的方法
powershell如何尝试调用现有方法?

[system.array]有.Get、.Set和.address方法,这些方法可通过.Net运行时使用,但通常不在powershell代码中使用。看看这个StackOverflow:

我不久前把它作为bug提交了。他们在V3中修复了它,并发布了异常消息Keith(可能会破坏运行时的稳定性)


很有趣。在V3上,我遇到了一个错误
PS>$a.address(2)异常,使用“1”参数调用“address”:“操作可能会破坏运行时的稳定性。”
谢谢!我没有找到这样的答案!现在一切都清楚了。