Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
using System;
using System.Collections;
namespace Collections
{
class Program
{
static void Main(string[] args)
{
ArrayList list = new ArrayList();
list.Add(2.3); // заносим в список объект типа double
list.Add(55); // заносим в список объект типа int
list.AddRange(new string[] { "Hello", "world" }); // заносим в список строковый массив
// перебор значений
foreach (object o in list)
{
Console.WriteLine(o);
}
// удаляем первый элемент
list.RemoveAt(0);
// переворачиваем список
list.Reverse();
// получение элемента по индексу
Console.WriteLine(list[0]);
// перебор значений
for (int i = 0; i < list.Count; i++)
{
Console.WriteLine(list[i]);
}
Console.ReadLine();
}
}
}