|
-
Jul 10th, 2007, 02:29 PM
#1
Thread Starter
Lively Member
[RESOLVED] [02/03] assigning a subset of an array in a single stmt
say i have two arrays, array1 and array2
array1 has 20 elements and array2 has 5 elements
i wish to assign array1 elements 0-4 to array2
can i do this in a single statement?
something like this though i don't think syntax is correct for vb:
-
Jul 10th, 2007, 02:39 PM
#2
Re: [02/03] assigning a subset of an array in a single stmt
Try Array.Copy (Array, Array, Int32)
From MSDN
Copies a range of elements from an Array starting at the first element and pastes them into another Array starting at the first element. The length is specified as a 32-bit integer.
Supported by the .NET Compact Framework.
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Jul 10th, 2007, 03:04 PM
#3
Thread Starter
Lively Member
Re: [02/03] assigning a subset of an array in a single stmt
 Originally Posted by kebo
Try Array.Copy (Array, Array, Int32)
From MSDN
Thanks. Exactly what I was looking for. And just to expand a bit in case anyone else looks at this thread. It can take a different number of parameters for more flexiblilty.
Array.Copy(sourceArray, sourceIndex, destinationArray, destinationIndex, length)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|