Retrieving values from an attribute of an object which is in an arraylist.

  • Thread starter Frustrated Newbie via DotNetMonster.com
  • Start date
F

Frustrated Newbie via DotNetMonster.com

I need to get the values of an attribute of each of three objects that I've
stored in an arraylist. Each object has three values, and one of those
values is an integer.

I'm able to "get" the values when from the objects when I instatiate an
object from the class I created, so I know each object does have the
attribute in question, and that the attribute has a value.

But now that the objects are in an arraylist, I can't figure out how to
retrieve the values from these objects in the arraylist.

Could someone point me at a strategy for figuring this out?
 
C

Cor Ligthert

Frustrated Newbie,

Normally
dim myfield = DirectCast(myArrayList(i),MyClass).MyItem

(Did you already looked at a datatable, that works in my opinion much more
flexible)

I hope this helps?

Cor
 
G

Guest

Cor, which is faster, DataTables or ArrayLists for saving and accessing data,
say a class with various properties.
 
C

Cor Ligthert

Dennis,

I don't think that the effect of your question is measurable, when you see
what you have to make using an arraylist, than you are creating almost the
same as a datatable and all code in the top of the ILS.

I cannot test it however from expirience I am sure that I cannot optimize it
as the guys from Microsoft can (They can create things inside the OS when it
is really needed and you get it with the next service pack). While on the
otherhand are you probably by *trying* to optimise this, busy in the small
part of the complete processing a program. (In the 20% part in the 80:20
rule)

As sample. I know that the remove/delete from a datatable is slow at the
moment. I know as well that this has the attention from Microsoft and will
be probably optimized in the next version. When that would be with an
arraylist you would have to do that yourself.

Just my thought,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top