<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ikorin2</author_name>
  <author_url>https://blog.hatena.ne.jp/ikorin2/</author_url>
  <blog_title>ネコのために鐘は鳴る</blog_title>
  <blog_url>https://ikorin2.hatenablog.jp/</blog_url>
  <categories>
    <anon>c#</anon>
    <anon>.NET</anon>
    <anon>programming</anon>
  </categories>
  <description>ラムダ式による外部変数のキャプチャは、コンパイラによって暗黙的に匿名クラスが作られ、コールされるたびに匿名クラスのインスタンスがnewされるため、ヒープアロケーションが発生する。 using System; public class Class { public Action Method(int num) { return () =&gt; Console.WriteLine(num); } } 上記のコードはコンパイラによって以下のコードと同義に解釈される。(コンパイラ生成コードの名前は見やすさの為に適当に変えてある) public class Class { [CompilerGenerate…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fikorin2.hatenablog.jp%2Fentry%2F2020%2F04%2F10%2F043143&quot; title=&quot;(C#) ラムダ式による this のキャプチャ - ネコのために鐘は鳴る&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>2020-04-10 04:31:43</published>
  <title>(C#) ラムダ式による this のキャプチャ</title>
  <type>rich</type>
  <url>https://ikorin2.hatenablog.jp/entry/2020/04/10/043143</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
