Permalink
Cannot retrieve contributors at this time
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?
School/C# - Beginner (Denis)/Lesson 69/lesson_69.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
36 lines (32 sloc)
1.12 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |