<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>potisan</author_name>
  <author_url>https://blog.hatena.ne.jp/potisan/</author_url>
  <blog_title>potisanのプログラミングメモ</blog_title>
  <blog_url>https://potisan-programming-memo.hatenablog.jp/</blog_url>
  <categories>
    <anon>C#</anon>
  </categories>
  <description>Span&lt;byte&gt;の要素参照から配列をマーシャリングしようとして、仕様通りの動作（参照型のref無し代入と整数型の暗黙アップキャスト）で例外が発生しました。 具体的には次のようなコードです。 var buf = new byte[256]; var t = Marshal.PtrToStructure&lt;byte&gt;(MemoryMarshal.GetArrayDataReference(buf)); // System.NullReferenceException: 'Object reference not set to an instance of an object.' この原因は次のコ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpotisan-programming-memo.hatenablog.jp%2Fentry%2F2026%2F07%2F19%2F143256&quot; title=&quot;C# Span&amp;lt;byte&amp;gt;の要素参照からnintへの変換の罠 - potisanのプログラミングメモ&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>2026-07-19 14:32:56</published>
  <title>C# Span&lt;byte&gt;の要素参照からnintへの変換の罠</title>
  <type>rich</type>
  <url>https://potisan-programming-memo.hatenablog.jp/entry/2026/07/19/143256</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
