473,396 Members | 1,760 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,396 software developers and data experts.

Count.ToString in ArrayList

I donot understand why it is this way.

I have an arraylist.

I understand I can get the count by arraylist.count

in .net studio, intellisense also gives me arraylist.count.tostring()
Nov 16 '05 #1
4 9190
COunt is an integer so MessageBox.Show(arraylist.Count); won't compile. If
you want to show what it is, you need to convert it to string and ToString()
is a good way to do it. Depending on the situation, you may need it in some
other form other than int.
"Krish" <sk*******@snet.net> wrote in message
news:87**************************@posting.google.c om...
I donot understand why it is this way.

I have an arraylist.

I understand I can get the count by arraylist.count

in .net studio, intellisense also gives me arraylist.count.tostring()

Nov 16 '05 #2
Hi Krish,

What do you not understand?

An ArrayList is a linked list that can grow and shrink in size when needed.
The ArrayList has a Count property that returns the number of items
"inside" the list.
This number is of type 'int', and the ToString() method will convert it to
'string'.

ArrayList myList = new ArrayList.

int numberInt = myList.Count; // returns 0
string numberString = myList.Count.ToString(); // returns "0";

myList.Count.ToString(); // is the same as
(myList.Count).ToString(); // which in this example is the same as
numberInt.ToString();

It would be much easier to help you if you can give us a clear question.
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3
Morten Wennevik <Mo************@hotmail.com> wrote:
An ArrayList is a linked list that can grow and shrink in size when needed.


No, an ArrayList is *not* a linked list. It's a list backed by an
array. It can grow and shrink in size when needed - if it exceeds the
bounds of the internal array, a new array is created and the contents
of the old one copied. That is all hidden from the client, however.

<snip stuff I agree with>

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
Ah, noted.
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #5

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

Similar topics

0
by: kovac | last post by:
The System.directoryservices.dll has an error, and this error was described in http://support.microsoft.com/default.aspx?scid=kb;en-us;839424 At the moment we have Framework version v1.0.3705 and...
2
by: Niklas E | last post by:
Does anyone know how to get all nodes in a xml-document that start with a certain text? In my case I want to count all suppliers ( <id>Supplier*</id> ) <root> <customer> <name>ABC</name>...
9
by: Terry E Dow | last post by:
Howdy, I am having trouble with the objectCategory=group member.Count attribute. I get one of three counts, a number between 1-999, no member (does not contain member property), or 0. Using...
2
by: Dan =o\) | last post by:
Hey guys, I'm getting really annoyed with this array... After selecting some items from a list view, I take the selected text from the first column and store it in an array, I then pass this...
2
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit...
2
by: Jon | last post by:
Hello all, I think I must be missing something here as it seems it should be simple, but I've just tried to do a 'arrExtRep.ToString() (where arrItems is an ArrayList) and I get the error: ...
3
by: Eric Cathell | last post by:
I am using an arraylist to process data....the unique problem i have run into is that if I delete one of the indexed values the arraylist is reindexed and i get an exception thrown. I need to start...
5
by: colin | last post by:
some enumerable types like collections use Count but but other enumerable types like arrays use length why the difference? Im not sure what my function is going to be passed yet, some...
18
by: Tony | last post by:
Hello! I have an ArrayList with many double that is sorted some of these double value exist more then once in the ArrayList. Is it possible to use some feature in C# or from the framework to...
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: 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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.