Add items to ArrayList and use foreach loop to check : ArrayList « Collections Data Structure « C# / C Sharp

C# / C Sharp
1. 2D Graphics
2. Class Interface
3. Collections Data Structure
4. Components
5. Data Types
6. Database ADO.net
7. Design Patterns
8. Development Class
9. Event
10. File Stream
11. Generics
12. GUI Windows Form
13. Language Basics
14. LINQ
15. Network
16. Office
17. Reflection
18. Regular Expressions
19. Security
20. Services Event
21. Thread
22. Web Services
23. Windows
24. XML
25. XML LINQ
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
C# / C Sharp » Collections Data Structure » ArrayListScreenshots 
Add items to ArrayList and use foreach loop to check


using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

class Program {
    static void Main(string[] args) {
        ArrayList baseballTeams = new ArrayList();
        baseballTeams.Add("s");
        baseballTeams.Add("r");
        baseballTeams.Add("F");

        foreach (string item in baseballTeams) {
            Console.Write(item + "\n");
        }

    }
}

           
       
Related examples in the same category
1. Add array to ArrayList
2. Remove range from ArrayList
3. Clone an ArrayList
4. CopyTo, ToArray(), ToArray(typeof(String))
5. Using foreach to loop through ArrayList and use Indexer of ArrayList
6. Check InvalidCastException when using foreach loop with ArrayList
7. Binary Search an ArrayList
8. Inserting into an ArrayList by index
9. Checks time needed for list operations using an ArrayList implementationChecks time needed for list operations using an ArrayList implementation
10. ArrayList Demo: hold classArrayList Demo: hold class
11. illustrates the use of ArrayList properties and methodsillustrates the use of ArrayList properties and methods
12. illustrates the use of an ArrayList that contains objects of the Car classillustrates the use of an ArrayList that contains objects of the Car class
13. illustrates the use of ArrayLists 2illustrates the use of ArrayLists 2
14. Convert an ArrayList into an arrayConvert an ArrayList into an array
15. Sort and search an ArrayListSort and search an ArrayList
16. Demonstrate ArrayListDemonstrate ArrayList
w__ww___._j_a___va2___s__._c_o__m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.