2007-12-26から1日間の記事一覧

Anonymous Type, Implicitly typed arrays, Collection initializers

C# 3.0 の Anonymous Type かつ Implicitly typed arrays という組み合わせで,毎回フィールド名を書かされるのは面倒,という話. var accessCounts = new[] { new { Month = new DateTime(2007, 1, 1), Total =25558, Unique = 18492}, new { Month = new …

C# の学習順序

2 年前に C# 3.0 が発表された直後にも似たことを思いましたが(id:NyaRuRu:20050921),今から C# を勉強し始めるとして,別に C# 1.x → C# 2.0 → C# 3.0 の順で勉強する理由もないのかもしれませんね.クエリ式とか,どうせ最初は構文的に憶えるんでしょうし…

type assertion

暗黙的型付け - R.Tanaka.Ichiro's Blog より. this.SetAmount(this.GetAmount()); というコードの置き換えとして // Type A double amount = this.GetAmount(); this.SetAmount(amount); と // Type B var amount = this.GetAmount(); this.SetAmount(amou…