473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1001

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Neil | last post by:
Hello, Is there a standard or recommended way of handling deletion and removal of objects in STL. I have loads of list of classes by pointer. e.g. If I have a list<int*>, how should I delete...
13
by: Sherif ElMetainy | last post by:
Hello I was just got VS 2005 preview, and was trying generics. I tried the following code int intArray = new int; IList<int> intList = (IList<int>) intArray; it didn't compile, also the...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
2
by: John Dalberg | last post by:
I am adding integer values from a datarow collection to a List<int> using the Add method. The values are read in the correct order from the collection but once the List is populated, the values in...
5
by: Gary | last post by:
I am using List<MyClassto store a bunch of MyClasses. And in my program, I want to change the content of one class in this list. However, it seems to me that this list keeps an original copy and is...
1
by: Jacek Dziedzic | last post by:
Hello! This is my first time dealing with Very Large Files. I have vector of strings representing numbers and I need to extract bytes in binary mode from a Large File that correspond to...
35
by: Lee Crabtree | last post by:
This seems inconsistent and more than a little bizarre. Array.Clear sets all elements of the array to their default values (0, null, whatever), whereas List<>.Clear removes all items from the...
0
by: DR | last post by:
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...
9
by: subramanian100in | last post by:
Consider the program x.cpp : #include <cstdlib> #include <iostream> #include <list> #include <map> using namespace std; int main()
1
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
Can I serialize a List<T>? I created a Serializable class with integers, strings, and a DateTime. To make it powerful, I used this class to create a List. Visual Studio 2005 Pro will not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.