{"id":2204,"date":"2024-07-29T03:38:05","date_gmt":"2024-07-29T03:38:05","guid":{"rendered":"https:\/\/histy.jp\/?p=2204"},"modified":"2024-07-30T12:25:28","modified_gmt":"2024-07-30T12:25:28","slug":"post-2204","status":"publish","type":"post","link":"https:\/\/histy.jp\/?p=2204","title":{"rendered":"2024\u5e747\u670829\u65e5\u6d3b\u52d5\u8a18\u9332"},"content":{"rendered":"\n<p>new int[] {9999, 9999, 999};<\/p>\n\n\n\n<p>\u3053\u308c\u306f\u4ed6\u306e\u30af\u30e9\u30b9\u306b\u3082\u4f7f\u3048\u308b\u3002<\/p>\n\n\n\n<p>new XXXCalss() {\u521d\u671f\u5024\u3092\u4ee3\u5165}\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>public class Pet<br>{<br>public required int Age;<br>public string Name;<br>}<\/p>\n\n\n\n<p>\/\/ <code>Age<\/code> field is necessary to be initialized.<br>\/\/ You don&#8217;t need to initialize <code>Name<\/code> property<br>var pet = new Pet() { Age = 10};<\/p>\n\n\n\n<p>\/\/ Compiler error:<br>\/\/ Error CS9035 Required member &#8216;Pet.Age&#8217; must be set in the object initializer or attribute constructor.<br>\/\/ var pet = new Pet();<\/p>\n<cite><a href=\"https:\/\/learn.microsoft.com\/ja-jp\/dotnet\/csharp\/programming-guide\/classes-and-structs\/object-and-collection-initializers\">\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u521d\u671f\u5316\u5b50\u3068\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u521d\u671f\u5316\u5b50 (C# \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 \u30ac\u30a4\u30c9)<\/a><\/cite><\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<p><a href=\"https:\/\/learn.microsoft.com\/ja-jp\/dotnet\/csharp\/language-reference\/xmldoc\/recommended-tags\">C# \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8 \u30b3\u30e1\u30f3\u30c8\u3068\u3057\u3066\u63a8\u5968\u3055\u308c\u308b XML \u30bf\u30b0<\/a><\/p>\n\n\n\n<p>\u30ad\u30e3\u30b9\u30c8\u306b\u3064\u3044\u3066<\/p>\n\n\n\n<p><a href=\"https:\/\/learn.microsoft.com\/ja-jp\/dotnet\/csharp\/programming-guide\/types\/casting-and-type-conversions\">\u30ad\u30e3\u30b9\u30c8\u3068\u578b\u5909\u63db (C# \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 \u30ac\u30a4\u30c9)<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/ufcpp.net\/study\/csharp\/oo_polymorphism.html#downcast\">https:\/\/ufcpp.net\/study\/csharp\/oo_polymorphism.html#downcast<\/a><\/p>\n\n\n\n<p>\u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8<\/p>\n\n\n\n<p><a href=\"https:\/\/atmarkit.itmedia.co.jp\/ait\/articles\/1808\/24\/news030.html\">VS Code\u3067\u9078\u629e\u7bc4\u56f2\u306e\u30c6\u30ad\u30b9\u30c8\u306e\u5927\u6587\u5b57\uff0f\u5c0f\u6587\u5b57\u3092\u5207\u308a\u66ff\u3048\u308b\u306b\u306f<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>new int[] {9999, 9999, 999}; \u3053\u308c\u306f\u4ed6\u306e\u30af\u30e9\u30b9\u306b\u3082\u4f7f\u3048\u308b\u3002 new XXXCalss() {\u521d\u671f\u5024\u3092\u4ee3\u5165}\u3002 public class Pet{public required int Age; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/histy.jp\/index.php?rest_route=\/wp\/v2\/posts\/2204"}],"collection":[{"href":"https:\/\/histy.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/histy.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/histy.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/histy.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2204"}],"version-history":[{"count":5,"href":"https:\/\/histy.jp\/index.php?rest_route=\/wp\/v2\/posts\/2204\/revisions"}],"predecessor-version":[{"id":2219,"href":"https:\/\/histy.jp\/index.php?rest_route=\/wp\/v2\/posts\/2204\/revisions\/2219"}],"wp:attachment":[{"href":"https:\/\/histy.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/histy.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/histy.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}