{"id":2815,"date":"2019-09-05T11:59:27","date_gmt":"2019-09-05T02:59:27","guid":{"rendered":"http:\/\/okamurax.com\/?p=2815"},"modified":"2019-09-07T22:59:47","modified_gmt":"2019-09-07T13:59:47","slug":"c-%e3%82%b7%e3%83%a7%e3%83%bc%e3%83%88%e3%82%b3%e3%83%bc%e3%83%89%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%9f%e3%83%b3%e3%82%b0","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=2815","title":{"rendered":"C# \u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30fbEffective C#"},"content":{"rendered":"<p>C# \u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u30b5\u30e9\u3063\u3068\u8aad\u3093\u3067\u307f\u3066\u6c17\u306b\u306a\u3063\u305f\u90e8\u5206\u306e\u307f\u30e1\u30e2\u3057\u3066\u304a\u304f\u3002<\/p>\n<p>\u30fb\u4f7f\u3063\u3066\u3044\u306a\u3044\u5f15\u6570\u3092\u524a\u9664\u3059\u308b\u3002<\/p>\n<p>\u30fb\u5c11\u306a\u3044\u5229\u7528\u306a\u3089using\u5ba3\u8a00\u3092\u524a\u9664\u3059\u308b\u3002<\/p>\n<p>\u30fb\u4e0d\u8981\u306a\u6539\u884c\u3092\u524a\u9664\u3057\uff11\u884c\u306b\u307e\u3068\u3081\u308b\u3002<\/p>\n<p>\u30fb\u30e1\u30bd\u30c3\u30c9\u3092\u5f0f\u5316\u3059\u308b\u3002<\/p>\n<p>\u30fb\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3092\u5f15\u6570\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3067\u7f6e\u304d\u63db\u3048\u308b\u3002<\/p>\n<p>\u30fbTryParse\u3068\u4e09\u9805\u6f14\u7b97\u5b50<br \/>\nint.TryParse(&#8220;a&#8221;, out int result) ? result : 99)<\/p>\n<p>\u30fbnull\u5408\u4f53\u6f14\u7b97\u5b50\u3092\u8907\u6570\u4f7f\u3046\u3002<br \/>\na ?? b ?? c ?? d<\/p>\n<p>\u30fbnull\u5408\u4f53\u6f14\u7b97\u5b50<br \/>\n\u5de6\u8fba\u304cnull\u3067\u306a\u3044\u5834\u5408\u306f\u5de6\u8fba\u3092\u8fd4\u3059\u3002<br \/>\n\u5de6\u8fba\u304cnull\u3067\u3042\u308b\u5834\u5408\u306f\u53f3\u8fba\u3092\u8fd4\u3059\u3002<br \/>\n??<\/p>\n<p>\u30fbnull\u6761\u4ef6\u6f14\u7b97\u5b50<br \/>\n\u5de6\u8fba\u304cnull\u3067\u3042\u308b\u5834\u5408\u306fnull\u3092\u8fd4\u3059\u3002<br \/>\n\u5de6\u8fba\u304cnull\u3067\u306a\u3044\u5834\u5408\u306f\u53f3\u8fba\u3092\u8a55\u4fa1\u3059\u308b\u3002<br \/>\n?.<br \/>\n?[]<\/p>\n<p>\u30fbnull\u5408\u4f53\u6f14\u7b97\u5b50\u3068\u6761\u4ef6\u6f14\u7b97\u5b50<br \/>\nstring n = user?.Name ?? &#8220;\u540d\u7121\u3057&#8221;<\/p>\n<p>\u30fb\u578b\u5224\u5b9a\u3068\u578b\u5909\u63db\u3092\u540c\u6642\u306b\u884c\u3046\u3002\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u30f3\u30b0\u3002<br \/>\n\u30ad\u30e3\u30b9\u30c8\u304c\u53ef\u80fd\u304b\u5224\u65ad\u3057\u53ef\u80fd\u306a\u3089\u53f3\u8fba\u306e\u5909\u6570\u306b\u4ee3\u5165\u3055\u308c\u308b\u3002<br \/>\nif(x is int y){}<br \/>\nswitch(x) {case int i}<\/p>\n<p>\u30fb\u914d\u5217\u306e\u7e2e\u5c0f\u30fb\u62e1\u5927<br \/>\nWhere().ToArray()<br \/>\nConcat().ToArray()<br \/>\nAppend().ToArray()<br \/>\nPrepend().ToArray()<\/p>\n<p>\u30fb\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u9593\u306b\u633f\u5165<br \/>\nx.Take().Append().Concat(x.Skip())<\/p>\n<p>\u30fb\u4f8b\u5916\u30d5\u30a3\u30eb\u30bf<br \/>\ntry{} catch() when(){}<\/p>\n<p>\u30fb\u540d\u524d\u304c\u5fc5\u8981\u306a\u3044\u578b\u306f\u30bf\u30d7\u30eb<\/p>\n<p>\u30fbstring.Format\u304b\u3089\u6587\u5b57\u5217\u88dc\u5b8c\u5f0f<br \/>\n$&#8221;{}&#8221;<\/p>\n<p>Effective C#\u306e\u7b2c\u4e00\u7ae0(C#\u8a00\u8a9e\u30a4\u30c7\u30a3\u30aa\u30e0)\u3092\u8aad\u3093\u3067\u4e00\u8a00\u3002<\/p>\n<p>\u30fb\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u3067var\u3092\u5229\u7528<\/p>\n<p>\u30fbconst\u3088\u308areadonly\u3092\u5229\u7528<\/p>\n<p>\u30fb\u30ad\u30e3\u30b9\u30c8\u306f()\u3088\u308ais\u304bas\u3092\u5229\u7528<\/p>\n<p>\u30fbstring.Format()\u3088\u308a\u88dc\u5b8c\u6587\u5b57\u5217\u3092\u5229\u7528<\/p>\n<p>\u30fb\u30b7\u30f3\u30dc\u30eb\u306e\u6587\u5b57\u5217\u30ea\u30c6\u30e9\u30eb\u306fnameof\u3067\u53d6\u5f97<\/p>\n<p>\u30fb\u30af\u30e9\u30b9\u9593\u306e\u3084\u308a\u3068\u308a\u306b\u30c7\u30ea\u30b2\u30fc\u30c8\u3092\u5229\u7528<\/p>\n<p>\u30fbnull\u6761\u4ef6\u6f14\u7b97\u5b50\u3092\u5229\u7528<\/p>\n<p>\u30fb\u30dc\u30c3\u30af\u30b9\u5316\u3001\u30dc\u30c3\u30af\u30b9\u5316\u89e3\u9664\u3092\u907f\u3051\u308b\u3002\u5024\u578b&gt;\u53c2\u7167\u578b(\u30dc\u30c3\u30af\u30b9\u5316)<\/p>\n<p>\u30fb\u7d99\u627f\u3057\u305f\u30e1\u30bd\u30c3\u30c9\u3092\u518d\u5b9a\u7fa9\u3057\u306a\u3044<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C# \u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u30b5\u30e9\u3063\u3068\u8aad\u3093\u3067\u307f\u3066\u6c17\u306b\u306a\u3063\u305f\u90e8\u5206\u306e\u307f\u30e1\u30e2\u3057\u3066\u304a\u304f\u3002 \u30fb\u4f7f\u3063\u3066\u3044\u306a\u3044\u5f15\u6570\u3092\u524a\u9664\u3059\u308b\u3002 \u30fb\u5c11\u306a\u3044\u5229\u7528\u306a\u3089using\u5ba3\u8a00\u3092\u524a\u9664\u3059\u308b\u3002 \u30fb\u4e0d\u8981\u306a\u6539\u884c\u3092\u524a\u9664\u3057\uff11\u884c\u306b\u307e\u3068\u3081\u308b\u3002 \u30fb\u30e1\u30bd\u30c3\u30c9\u3092\u5f0f\u5316\u3059 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=2815\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;C# \u30b7\u30e7\u30fc\u30c8\u30b3\u30fc\u30c9\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30fbEffective C#&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9],"class_list":["post-2815","post","type-post","status-publish","format-standard","hentry","category-1","tag-c-net"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2815"}],"version-history":[{"count":3,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2815\/revisions"}],"predecessor-version":[{"id":2827,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/2815\/revisions\/2827"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}