Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Practicing List Declaration | Additional Structures & File Handling
C# Beyond Basics

Practicing List DeclarationPracticing List Declaration

Fill in the blanks to declare a list called numbers that stores integer numbers from 1 to 10. Use explicit declaration for declaring the list.

cs

index.cs

We declare empty lists by using the List name = new List(); syntax. Initializing a list with some data has a very similar syntax.

using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        List<int> numbers = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

        foreach (int num in numbers)
            Console.Write(num + " ");
    }
}   
      

Все було зрозуміло?

Секція 1. Розділ 2
course content

Зміст курсу

C# Beyond Basics

Practicing List DeclarationPracticing List Declaration

Fill in the blanks to declare a list called numbers that stores integer numbers from 1 to 10. Use explicit declaration for declaring the list.

cs

index.cs

We declare empty lists by using the List name = new List(); syntax. Initializing a list with some data has a very similar syntax.

using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        List<int> numbers = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

        foreach (int num in numbers)
            Console.Write(num + " ");
    }
}   
      

Все було зрозуміло?

Секція 1. Розділ 2
some-alt