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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fastest way to keep adding objects into array? 1

Status
Not open for further replies.

Skute

Programmer
Jul 21, 2003
272
GB
Hi, whats the fastest way to keep adding data onto the end of an array? I know you cant resize an array but this is the method ive come up with:

Code:
	string[] strTest1 = new string[1];
	strTest1[0] = "Hello!";

	string[] strTest2 = new string[2];
	strTest2[0] = strTest1[0];
	strTest2[1] = "Another Test!";

	strTest1 = strTest2;

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Have you thought of using an ArrayList instead which is dynamically resizeable?

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
hmm didnt know about that class, am checking it out now. ta

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Seems to work great, thanks alot. Have a star! :)

Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top