|
-
Feb 25th, 2005, 03:11 PM
#1
Thread Starter
Fanatic Member
Pass part of an array
Can you pass part of an array?
For example, if I have an array of 4....can I pass the first half and then the second half in to a function? What I mean by half is like the first two elements and then the second two.
Hope this is clear enough for a general answer.
Thanks!
-
Feb 26th, 2005, 02:19 AM
#2
Sleep mode
Well , I don't think so . An array is contiguous cells allocated in the memory identitified by one name . As a workaround , you can make temp array that hold two elements and copy from the source just the two .
-
Feb 26th, 2005, 03:20 AM
#3
Re: Pass part of an array
You could use unsafe code and pass a pointer to the first elements in each section. A better solution would be to have each function take the the array, a start, and length arguments to determine where it should get its arguments from.
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Feb 26th, 2005, 03:26 AM
#4
Sleep mode
Just to clear something up , I was talking in a managed code view point.
-
Feb 26th, 2005, 05:07 PM
#5
Re: Pass part of an array
 Originally Posted by Pirate
Just to clear something up , I was talking in a managed code view point.
Which is definently a better option. There's no reason to use unsafe code for something like this where you could design it better using a managed solution. I was just throwing that out there
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Feb 27th, 2005, 08:18 PM
#6
Re: Pass part of an array
try the Array.GetValue (params long[] indecies) method.
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
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
|