Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating and accessing lists of objects

Status
Not open for further replies.

stonee74

Technical User
Nov 12, 2001
49
0
0
CH
Hi there,

I would like to create a kind of list which can hold different objects created at runtime.
(list.write(xxx))
Then i would need an instance of that class and read values from that list out to a self defined time (list.read()).
What'a the best approach to do such a thing in c#?

thanks,
stonee



 
ArrayList class.
example:

struct A
{
int b;
int c;
}

ArrayList alist = new Arraylist();
A a;
a.b = 5;
a.c = 3;
alist.Add(a);
a = (A)alist[0]; // conversion to A is necessary because ArrayList returns type Object

more help:
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemCollectionsArrayListMembersTopic.htm
 
thanks,

I took queues, works great.

regards,
stonee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top