为什么在添加Powershell字符串和数组时操作数的顺序很重要?

时间:2018-10-12 20:35:13

标签: powershell types operators implicit-conversion weak-typing

在powershell中,当我添加字符串+数组时,结果是一个字符串,但是当我添加数组+字符串时,结果是一个数组?为什么会这样?

string plus array vs array plus string

1 个答案:

答案 0 :(得分:1)

PowerShell将第二个操作数转换为第一个操作数的类型(如果可以的话)。