Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ チャレンジ:リスト宣言 | データ構造とファイル操作
C#オブジェクト指向構造

bookチャレンジ:リスト宣言

メニューを表示するにはスワイプしてください

空欄を埋めて、1から10までの整数を格納するリスト numbers を宣言してください。リストの宣言には明示的な宣言を使用してください。

index.cs

index.cs

copy
12345678910111213
using 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 + " "); } }

空のリストは List<type> name = new List<type>(); 構文を使って宣言します。データを初期化してリストを作成する場合も、非常に似た構文を使用します。

index.cs

index.cs

copy
12345678910111213
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

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 1.  2
some-alt