<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>iwaoww</author_name>
  <author_url>https://blog.hatena.ne.jp/iwaoww/</author_url>
  <blog_title>右足から前へ　とんがらず、並盛で。</blog_title>
  <blog_url>https://iwaoww.hatenadiary.org/</blog_url>
  <categories>
    <anon>C#</anon>
  </categories>
  <description>というのも、デフォルトコンストラクタだけなら良いのですが、やはりオーバーロードにより、複数個のコンストラクタが実装されることもあるかと思います。 このような状況下において、全てのコンストラクタで初期化が正しく行われないことを懸念し、コンストラクタではなく、メンバ定義時に初期化子で実装すべきということです。 が、やっちゃいけないのは以下の3つです。 0やnullに初期化するのは無駄です。C#では変数は0で初期化されるので。 コレクションのサイズがコンストラクタ毎に異なる場合。異なるサイズでnewした時点で、初期化子分がGC対象となるので、無駄が発生です。 初期化時に例外が発生するケース。変数初期…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fiwaoww.hatenadiary.org%2Fentry%2F20110309%2F1299626961&quot; title=&quot;メンバ変数は例外が発生しない限り、コンストラクタで初期化しない - 右足から前へ　とんがらず、並盛で。&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2011-03-09 08:29:21</published>
  <title>メンバ変数は例外が発生しない限り、コンストラクタで初期化しない</title>
  <type>rich</type>
  <url>https://iwaoww.hatenadiary.org/entry/20110309/1299626961</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
