Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Working with an arraylist

Author  Topic 

mary_itohan
Posting Yak Master

191 Posts

Posted - 2008-01-16 : 08:18:09
Hello,
If i add to my arraylist some phone numbers
How do i

1. Check for the phone numbers that dont meet the lenght requirement
2. Remove the unwanted numbers

Here is part of my code




class Program
{
static void Main(string[] args)
{
ArrayList Phone_numbers = new ArrayList(); Phone_numbers.Add(new numbers("USA"));
((USA)Phone_numbers[0]).colNumber.Add(new Number("Johnson", 12));

((USA)Phone_numbers[0]).colNumber.Add(new Number("Michael", 14));

((USA)Phone_numbers[0]).colNumber.Add(new Number("John", 15));


Phone_numbers.Add(new numbers("UK"));
((UK)Phone_numbers[1]).colNumber.Add(new Number("Johnson", 19));

((UK)Phone_numbers[1]).colNumber.Add(new Number("Michael", 17));

((UK)Phone_numbers[1]).colNumber.Add(new Number("John", 14));



Yes O !

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2008-01-16 : 08:33:31
It all depends on your Numbers and Number classes and how they work. We have no idea because we don't have the code. You are just using the ArrayList, it appears, to hold a list of Numbers objects, so you'd need to see what properties and methods are available in your Numbers and Number classes to validate them and/or remove and edit them. This really has nothing to do with an ArrayList.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -