【问题标题】:Why does order of operands matter when adding powershell strings and arrays? [duplicate]为什么在添加 powershell 字符串和数组时操作数的顺序很重要? [复制]
【发布时间】:2019-03-18 02:33:50
【问题描述】:

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

【问题讨论】:

  • 与链接答案中的原因相同。在你的第二个例子中,就像在做"a" + "$(@('b','c','d'))"

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-22
    • 2014-09-13
    • 1970-01-01
    • 2017-11-08
    • 1970-01-01
    相关资源
    最近更新 更多