Re: How to pass a 2-D array into a function?
- From: Gman <nah>
- Date: Mon, 14 Nov 2005 23:11:20 -0600
Cool! I'm only on chapter 8 of my new .NET book (arrays don't make an appearance until chap 11) so that's very good news. I can throw away some of my bag of tricks.
Michael C wrote:
"Gman" <nah> wrote in message news:uz6JSwZ6FHA.3416@xxxxxxxxxxxxxxxxxxxxxxx
Ain't it?! :-)
I keep an arsenal of functions for adding items to an array, returning an index in an array etc. to save me making myself dizzy by having to loop through arrays all the time.
As I understand it (and I may be guilty of spouting misinformation again here) Delphi has native methods to handle things like the above or allowing the easy deletion of an element in the middle of an array without having to load everything into a new array. VB.NET doesn't appear to have improved on arrays at all (other than eliminating 1 based arrays and allowing for one line declaration like Dim X() as long = (1,2,3,4) ... or something along those lines. While I guess using collections is feasible in some circumstances it's staggering that VB.NET still seems to fall short on something so fundamental. Oh... and there's also ArrayLists in .NET -- something I haven't looked at so maybe I should get off my high horse.
.net does have functions like this for arrays. You can do Array.IndexOf to find if an item exists. You can't add an element because arrays shouldn't really be sizable as they are a contiguous block of memory, if you need resizability the arraylist should be used. Lots of other functions have been added too such as sorting. C# doesn't have any way to redim an array like vb does as the redim is quite inefficient. In vb.net it creates a new array and copies the entire contents to the new array each time a redim is called.
Michael
.
- Follow-Ups:
- Re: How to pass a 2-D array into a function?
- From: Michael C
- Re: How to pass a 2-D array into a function?
- References:
- Re: How to pass a 2-D array into a function?
- From: Gman
- Re: How to pass a 2-D array into a function?
- From: Michael C
- Re: How to pass a 2-D array into a function?
- From: Dmitriy Antonov
- Re: How to pass a 2-D array into a function?
- From: Michael C
- Re: How to pass a 2-D array into a function?
- From: Gman
- Re: How to pass a 2-D array into a function?
- From: Michael C
- Re: How to pass a 2-D array into a function?
- Prev by Date: Re: MSForms in VB6.0 Project - Cannot Quit
- Next by Date: Re: Line print to USB printer
- Previous by thread: Re: How to pass a 2-D array into a function?
- Next by thread: Re: How to pass a 2-D array into a function?
- Index(es):
Relevant Pages
|
Loading