<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>Takachan</author_name>
  <author_url>https://blog.hatena.ne.jp/Takachan/</author_url>
  <blog_title>PG日誌</blog_title>
  <blog_url>https://takap-tech.com/</blog_url>
  <categories>
    <anon>C#</anon>
    <anon>C++</anon>
    <anon>.NET Framework</anon>
  </categories>
  <description>C/C++にあるunionをC#で使用する方法は、ネットにいくつか解説しているサイトがあります。しかし、構造体がunionになったものは例があまりないため紹介したいと思います。 基本的に、StructLayout = &quot;LayoutKind.Explicit&quot;（明示的にレイアウトを指定する）とFieldOffsetの組み合わせで実現できます。 [StructLayout(LayoutKind.Explicit)] public struct Parent { [FieldOffset(0)] public int A; [FieldOffset(4)] public UnionStructur…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftakap-tech.com%2Fentry%2F2018%2F03%2F12%2F200847&quot; title=&quot;C#で構造体のunion（共用体）を扱う - PG日誌&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>https://cdn-ak.f.st-hatena.com/images/fotolife/T/Takachan/20170920/20170920004006.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-03-12 20:08:47</published>
  <title>C#で構造体のunion（共用体）を扱う</title>
  <type>rich</type>
  <url>https://takap-tech.com/entry/2018/03/12/200847</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
