帝王 发表于 2018-9-3 10:45:14

Powershell学习笔记4—Arrays&sequences

Polymorphism in arrays  Another important thing to note from the previous example is that arrays are polymorphic by default. By polymorphic we mean that you can store any type of object in an array. (A VBScript user would call these variant arrays). When we created the array,we assigned only integers to it. In the subsequent assignments, we assigned a floatingpoint number and a string. The original array was capable of storing any kind of object. In formal terms, PowerShell arrays are polymorphic by default (though it is possible to create type-constrained arrays). Earlier we saw how to get the length of an array. What happens when we try to assign to an element past the end of the array?

页: [1]
查看完整版本: Powershell学习笔记4—Arrays&sequences