・配列
string[] str = {"aaa", "bbb", "ccc"};
int[] num = {1, 2, 3, 4, 5};
List
・structの初期化
using System.Collections.Generic; namespace SampleCode { class Program { static void Main(string[] args) { Listlist = new List (); list.Add(new MyClass { age = 3, name = "bbb" }); list.Add(new MyClass { age = 10, name = "aaa"}); } } struct MyClass { public string name { get; set; } public int age { get; set; } } }
0 件のコメント:
コメントを投稿