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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DR

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

    System.Collecti ons.Generic.Lis t<intmyList = new
    System.Collecti ons.Generic.Lis t<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?


Working...