<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>noriok</author_name>
  <author_url>https://blog.hatena.ne.jp/noriok/</author_url>
  <blog_title>C#練習日記</blog_title>
  <blog_url>https://noriok.hatenadiary.jp/</blog_url>
  <categories>
  </categories>
  <description>クラス A と、クラス B が IDisposable を実装しているとします。 そのときに、3 項演算子を用いて、以下のように書くことはできないようです。 class A : IDisposable { ... } class B : IDisposable { ... } // コンパイルエラーになる: There is no implicit conversion between 'A' and 'B' IDisposable c = true ? new A() : new B(); IDisposable でキャストすれば問題なくコンパイルできます。 // OK IDisposabl…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnoriok.hatenadiary.jp%2Fentry%2F2017%2F12%2F23%2F124536&quot; title=&quot;インターフェース型の変数への代入と 3 項演算子を組み合わせるとコンパイルエラーになる - C#練習日記&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>2017-12-23 12:45:36</published>
  <title>インターフェース型の変数への代入と 3 項演算子を組み合わせるとコンパイルエラーになる</title>
  <type>rich</type>
  <url>https://noriok.hatenadiary.jp/entry/2017/12/23/124536</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
