471,325 Members | 1,450 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

System.Collections.Generic.List<int> myList = new System.Collections.Generic.List<int>(100);

DR
System.Collections.Generic.List<intmyList = new
System.Collections.Generic.List<int>(100);

Does this preallocate 100 integers?

Also, is there any way to preallocate an array of objects all at once?

MyOb[] al= new MyOb[100];

for (int z = 0; z < nCount; z++)

{

al[z] = new MyOb();

}

Can i avoid all these new and just allocate an array of MyOb all at once?
Apr 9 '08 #1
0 952

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Sherif ElMetainy | last post: by
6 posts views Thread by Chris Fink | last post: by
2 posts views Thread by John Dalberg | last post: by
5 posts views Thread by Gary | last post: by
35 posts views Thread by Lee Crabtree | last post: by
9 posts views Thread by subramanian100in | last post: by
1 post views Thread by =?Utf-8?B?anAybXNmdA==?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.