In the above we describe how to use "Static array", the content involves the creation of the array, the addition of elements, and so on, it is very obvious that the way to manipulate an array is very troublesome, the purpose of the static array is to let you understand the basic concepts and operations of the array, in the actual use of the array script, We will create dynamic arrays to better improve the speed and ease of writing of scripts.
dynamic arrays, which are defined using a. Net class, can be compared as a static array, which makes it easy to make element changes in addition to the index lookup, and it is also free to add a single element instead of redefining the entire array when the element is added in a loop. This greatly improves the operation speed of the script.
A dynamic array definition, the dynamic array definition does not specify an arbitrary array size, the initial definition of the dynamic array does not contain any objects, so you can not do anything about it;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/51/wKioL1W2V46AQ6OtAAA8fHh2_yk828.jpg "style=" float: none; "title=" 1.png "alt=" Wkiol1w2v46aq6otaaa8fhh2_yk828.jpg "/>
Secondly, dynamic array elements are added and removed, and the dynamic array can be manipulated directly on the basis of the original array because it does not directly specify the size of the array.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/54/wKiom1W2VaLDa9TQAACiukc3Ugk156.jpg "style=" float: none; "title=" 2.png "alt=" Wkiom1w2valda9tqaaciukc3ugk156.jpg "/>
After the dynamic array executes the element's addition, the default is to echo the element's index number in the array, and if you want to mask it can be manipulated by means of the out-null of the passed character;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/51/wKioL1W2V46A2A66AABLSW68CWU304.jpg "style=" float: none; "title=" 3.png "alt=" Wkiol1w2v46a2a66aablsw68cwu304.jpg "/>
- The Remove method can be used for removing elements;
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/51/wKioL1W2V46Rq_1xAAA_Ztnc7Fo966.jpg "style=" float: none; "title=" 4.png "alt=" Wkiol1w2v46rq_1xaaa_ztnc7fo966.jpg "/>
Third, dynamic array of other methods and static array consistent, no longer repeat, can refer to "Powershell array use (a)" Static array ""
Clone:$Array 2 = $Array 1.clone ()
substitution of elements:$Array 1[1]= "World"
element Lookup:$Array 1[1].contains ("Hello"), $Array 1–like "*hello*";
This article is from the "Essence of the" blog, please be sure to keep this source http://simy88.blog.51cto.com/7370552/1678950
Use of Powershell arrays (i) "Dynamic array"