
Topic Name
Introduction to C#
Environment Setup
C# Keywords
Contextual Keywords
C# Namespaces
What Is Class?
What is Object?
Data Types
Nullable Types
C# Variables
What are Access Modifiers?
What is Property?
What is Indexer?
Hello world Program
What is Type conversion?
What is if else condition?
What is Array?
What is Jagged Array?
What is ArrayList?
What is List?
What is string and StringBuilder?
What is for loop?
What is foreach loop?
What is switch?
What is Method?
What is method overloading?
What is Constructor?
What is constructor overloading?
What is Boxing and Unboxing?
What is delegate in C# and uses of delegates?
What is Inheritance?
What are Value types and Reference types?
What is Exception Handling?
What is struct?
What is Dictionary?
What is Hashtable?
What is interface?
What is Abstraction?
What is Polymorphism?
What is Enums?
What is Sealed Class?
What is Partial Class?
Extension Methods?
What is static?
What is Encapsulation?
Difference between Equality Operator (==) and Equals() Method in C# ?
What is IEnumerable?
What is Serializing?
What is LINQ?
Differences between IEnumerable and IQueryable?
What is Multithreading?
What is File Handling?
What is late binding and early binding?
What is Singleton Design Patterns?
ArrayList is a collection of data. This list is non-generic data type. We can’t need to assign size of the collection also we can’t set the type. It is automatically type cast by the value. ArrayList is dynamically behaver like objects. ArrayList like loosely typed. We can also use add method in ArrayList. Now given example code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using testForClass1;
namespace testFor
{
class Program
{
static void Main(string[] args)
{
ArrayList myArrayList = new ArrayList() { 100, 5.3, "jesy", 'k', false };
foreach (var arrayList in myArrayList)
{
Console.WriteLine("Value are : " + arrayList + " ---- Type : " + arrayList.GetType());
}
Console.WriteLine();
Console.WriteLine();
ArrayList myArrayListAddMethod = new ArrayList();
myArrayListAddMethod.Add(100);
myArrayListAddMethod.Add(5.3);
myArrayListAddMethod.Add("jesy");
myArrayListAddMethod.Add('k');
myArrayListAddMethod.Add(false);
foreach (var arrayList in myArrayListAddMethod)
{
Console.WriteLine("Value are : " + arrayList + " ---- Type : " + arrayList.GetType());
}
Console.Read();
}
}
}
In this code we use the “myArrayList” which is direct assign value and print the value using the foreach loop. Then we use the add method to assign value into “myArrayListAddMethod” and print the value using foreach loop also it’s printed the type of value.