「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。

-[[戻る>.NET言語]]

* 目次 [#o6a7ac42]
#contents

*概要 [#bbeab94d]
スニペット置き場が欲しかったので。

*詳細 [#j1cdd26f]

*スニペット [#rd342cba]

**初期化 [#rb02e6fb]

***配列 [#i9b340b1]
-配列
 int[] array1 = new int[] { 1, 3, 5, 7, 9 };

-List
 List<int> digits = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };  

-Dictionary
 Dictionary<string, string> openWith
    = new Dictionary<string, string>()
 {
   {"txt", "notepad.exe"},
   {"bmp", "paint.exe"},
   {"dib", "paint.exe"},
   {"rtf", "wordpad.exe"}
 };

***オブジェクト [#dcac4226]
-memberの初期化
 Point p = new Point{ X = 0, Y = 1 };

-memberのnew
 var x = new Line
 {
  A = { X = 1, Y = 2 },
  B = { X = 3, Y = 4 },
 };

- var(anonymous type)
 // anon is compiled as an anonymous type
 var anon = new { Name = "Terry", Age = 34 };

*参考 [#lc4bd41f]
**[[LINQ]] [#x0c4e8c9]
**[[ラムダ式って]] [#a771ccd1]

----
Tags: [[:.NET開発]], [[:プログラミング]]

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS