PC Review


Reply
Thread Tools Rate Thread

buggy ArrayList

 
 
Andreas Schulz
Guest
Posts: n/a
 
      26th Sep 2003
Hi,

when I recently used an ArrayList to store multiple string objects I
mentioned that there is no method for getting a specific value. The docu
says the Item property to get a specific element is not supported by the
compact framework. Fine, but how to get the values else? Inserting at a
specific position is no problem since there is an Add method with
several overloadings.

What I did to get the values back was to copy the ArrayList to a string
array by using the CopyTo method and then getting the values out of
string array.

But that can't be the way to do, can it?

 
Reply With Quote
 
 
 
 
sascha78@gmx.net
Guest
Posts: n/a
 
      26th Sep 2003
Hi Andreas

you can access the elements like an array:
ArrayList arrList; -> arrList[1] to access the element on position 1

or

arrList.IndexOf(object o) -> find out an index of an object

hoped this will help you

greets
sascha




Andreas Schulz wrote:
> Hi,
>
> when I recently used an ArrayList to store multiple string objects I
> mentioned that there is no method for getting a specific value. The docu
> says the Item property to get a specific element is not supported by the
> compact framework. Fine, but how to get the values else? Inserting at a
> specific position is no problem since there is an Add method with
> several overloadings.
>
> What I did to get the values back was to copy the ArrayList to a string
> array by using the CopyTo method and then getting the values out of
> string array.
>
> But that can't be the way to do, can it?
>


 
Reply With Quote
 
Andreas Schulz
Guest
Posts: n/a
 
      26th Sep 2003
Thanks a lot Sascha. It works great and saves a lot of time.
>-----Original Message-----
>Hi Andreas
>
>you can access the elements like an array:
>ArrayList arrList; -> arrList[1] to access the element on

position 1
>
>or
>
>arrList.IndexOf(object o) -> find out an index of an object
>
>hoped this will help you
>
>greets
>sascha
>
>
>
>
>Andreas Schulz wrote:
>> Hi,
>>
>> when I recently used an ArrayList to store multiple

string objects I
>> mentioned that there is no method for getting a specific

value. The docu
>> says the Item property to get a specific element is not

supported by the
>> compact framework. Fine, but how to get the values else?

Inserting at a
>> specific position is no problem since there is an Add

method with
>> several overloadings.
>>
>> What I did to get the values back was to copy the

ArrayList to a string
>> array by using the CopyTo method and then getting the

values out of
>> string array.
>>
>> But that can't be the way to do, can it?
>>

>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thread-safety: Change property of items in arraylist versus removingitems from the arraylist Curious Microsoft Dot NET 2 6th Aug 2008 12:36 PM
How to access ArrayList values inside another ArrayList? Pavel Maly Microsoft C# .NET 6 30th Oct 2006 01:46 PM
ArrayList(ICollection) constructor & overriden ArrayList.AddRange(). Sylvain Microsoft C# .NET 1 4th Jun 2005 01:19 AM
Is Convert.ToSByte buggy or am I buggy? David Levine Microsoft Dot NET 4 13th Feb 2005 10:45 PM
buggy ArrayList Andreas Schulz Microsoft Dot NET Compact Framework 2 26th Sep 2003 12:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:18 PM.