![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | number of elements in array Hi, Is there a variable that tells me how many elements there are in an array? thanks, |
My System Specs![]() |
| | #2 (permalink) |
| | Re: number of elements in array "Frank" <Frank@discussions.microsoft.com> wrote in message news:4EA172A3-070A-465D-A100-C7AE54EB2BEE@microsoft.com... > Hi, > > Is there a variable that tells me how many elements there are in an array? > There is a property called Length on all .NET arrays. Use like so to find out how many elements are in the first dimension of an array: > $arr = 1,2,3,4 > $arr.Length 4 -- Keith |
My System Specs![]() |
| | #3 (permalink) |
| | Most collections use Count instead of Length. It is just one of the little inconsistencies in .NET. PowerShell provides an alias property so you can always use COUNT: PS> $a=1,2,3,4,5 PS> $a.Length 5 PS> $a.Count 5 |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Inserting or deleting elements in an array | VB Script | |||
| Converting array elements between types | PowerShell | |||
| Get Index Number of Array Item? | PowerShell | |||
| re-ordering elements in an array? | PowerShell | |||