Desafio: Declaração de Lista
Preencha as lacunas para declarar uma lista chamada numbers que armazena números inteiros de 1 a 10. Utilize declaração explícita para declarar a lista.
index.cs
12345678910111213using System; using System.Collections.Generic; class Program { static void Main(string[] args) { ___ ___ = ___ ___ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; foreach (int num in numbers) Console.Write(num + " "); } }
Você declara listas vazias utilizando a sintaxe List<type> name = new List<type>();. Inicializar uma lista com alguns dados possui uma sintaxe muito semelhante.
index.cs
12345678910111213using 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 + " "); } }
Obrigado pelo seu feedback!
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Can you give me a hint for filling in the blanks?
Can you show me the solution for declaring the list?
Can you explain what "explicit declaration" means in this context?
Awesome!
Completion rate improved to 2.04
Desafio: Declaração de Lista
Deslize para mostrar o menu
Preencha as lacunas para declarar uma lista chamada numbers que armazena números inteiros de 1 a 10. Utilize declaração explícita para declarar a lista.
index.cs
12345678910111213using System; using System.Collections.Generic; class Program { static void Main(string[] args) { ___ ___ = ___ ___ { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; foreach (int num in numbers) Console.Write(num + " "); } }
Você declara listas vazias utilizando a sintaxe List<type> name = new List<type>();. Inicializar uma lista com alguns dados possui uma sintaxe muito semelhante.
index.cs
12345678910111213using 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 + " "); } }
Obrigado pelo seu feedback!