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