h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

ArrayList in C#.net


             First time, User uses this ArrayList class this error will occur.
Reason: Because user doesn’t declare a namespace for ArrayList.
Solution: Declare Namespace Using System.Collection.
In this Sample Project, I am using enumeration and ArrayList.



In this Example, I am creating an enumeration and Call that enumeration into ArrayList and sort that ArrayList.
Some useful Methods in ArrayList:
  1. Add
  2. AddRange
  3. Remove
  4. RemoveAt
  5. Sort
  6. RemoveRange
Add:
   User can add a information into ArrayList Using Add Method.
This is a Simple Example for Add Method.



AddRange:
     Add the elements of an ICollection to the end of the ArrayList.
ICollection:
· It is an Interface. Because it starts with “I”. Generally, “I” is called Interface.
· Defines size, enumerators, and synchronization methods for all nongeneric collections.



 
Here, I give a sample code for AddRange Method for ArrayList create a two enumeration .One is ComName and another one is ComPort.
Remove:
       User can remove a list of items in ArrayList.
       User can specify a Word.

 
RemoveAt:
       User can remove a list of items in ArrayList.
       User can specify a Index no.



RemoveRange:
       User can remove a list of items in ArrayList.
       User can specify range of remove.