List Info

Thread: C-Sharp (C#) Group: Efficiently convert Base 1 Array to Base 0 Array?




C-Sharp (C#) Group: Efficiently convert Base 1 Array to Base 0 Array?
user name
2006-02-08 15:44:26
Hi all,

My scenario is as follows:

* Receive a base 1 array (index starts at 1 instead of 0) of
data from
a COM component .
* Need to pass this array to a .net component that requires
its array
index to start at 0.
* As a result, must convert array from base1 to base 0.

Currently my solution for this is to create a new array and
copy the
contents of is as follows:
* Create new based 0 array
* Copy the content of base 1 array to new array by
1)iterating through
each element in base 1 array and 2)doing assignment to base
0 array.
* Assign new array to array used by .net component described
above.

My question is as follows:
Is there a quicker way to convert a base1  array to base0
without
having to do iteration and assignment? Does something in the
.net
framework already do this?

Thanks,
Peter
www.nofelt.com

C-Sharp (C#) Group: Re: Efficiently convert Base 1 Array to Base 0 Array?
user name
2006-02-08 20:45:00
whenever you declare an array list you can specify the array
as an
argument, or you can do ArrayList.Insert(array) and then
make sure you
get rid of the first element if it is empty (which i would
think it
won't)

if you have access to your vb code and you can modify it you
can always
set Option Base 0 which will make the arrays zero based.

Marty

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )