
Namespace: System.Collections
Library: mscorlib.dll
The .NET API has a set of Classes very useful. At some of the the next lessons we will see a resume of the members (properties, methods etc.) of the more importants. It's not a complete "Reference". If you don't find what you need, here, try the official SDK Documentation.
For some members we will present a little exercice, a little test. The Visual C# Express has a good tool to be used for tests of little pieces of code. Open it and select: File | New Project | Console Application | OK and you will have a file Program.cs to be used to type your code .
For the compilation select: Debug | Start Without Debugging and will open a black window having the program running.
The index of the first element is: 0 (zero).
IMPORTANT: The library mscorlib.dll doesn't need to be declared at the .CSPROJ file.
Let's go to see some methods and properties:
Add(something)
This method adds a new element and returns the new quantity of elements of the ArrayList;
Example:
Clear()
Contains(something)
Example:
Only beeing a String the value can be tested.
GetRange(int init, int n)
Returns a new ArrayList having the n elements from init included.
Insert(int i, something)
Inserts an element at the i position.
LastIndexOf(something)
Returns the position of the last element having the value something.
Remove(something)
RemoveAt(int i)
Reverse()
Sort()
Example:
And, finally, a property having the quantity of elements:
Count
PREVIOUS LESSON NEXT LESSON T.CONTENTS HOMEPAGE
