DateTime型
1 2 | DateTime now = DateTime.Now; DateTime date = new DateTime(2015, 8, 21); |
配列
1 | string [] texts = { "文字列1" , "文字列2" , "文字列3" }; |
List
1 | var texts = new List< string >() { "文字列1" , "文字列2" , "文字列3" }; |
Dictionary(ディクショナリ)型
1 2 3 4 5 6 | var texts = new Dictionary< int , string >() { { 0, "text1" }, { 1, "text2" }, { 2, "text3" } }; |
クラス(プロパティ)
1 2 3 4 5 6 | public class TestClass { public int No { get ; set ; } public string Text { get ; set ; } }; var test = new TestClass() { No = 1, Text = "initValue" }; |
Dictionary(ディクショナリ)型の初期化にクラスも入れられたり
1 2 3 4 5 | var test= new Dictionary< int , TestClass>() { { 0, "new TestClass() { No = 1, Text = " initValue" } }, { 1, "new TestClass() { No = 2, Text = " initValue" } }, }; |
後はなんかあったっけな?