<?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>.NET</anon>
    <anon>.NET Core</anon>
    <anon>.NET Framework</anon>
    <anon>C#</anon>
    <anon>Unity</anon>
  </categories>
  <description>この記事は、あるクラスの中で管理しているリストや配列をクラス外に公開して参照してもらう時に安全に公開する方法や考え方や実装の紹介です。 あるクラス内で管理しているリストをクラス外に公開する場合に具体的にどういった危険性があるのか、どうすれば安全なのかを考えていきます。 はじめに リストを外部に渡す時の要件 解決方法 要素を変更できないようにする 配列やリストを変更されないようにする はじめに 例えば、以下の例のようにあるクラス内でリストを持っていてそれを外部に公開するケースです。 // リストを持っているクラス public class ListContainer { List&lt;Item&gt; _…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftakap-tech.com%2Fentry%2F2021%2F11%2F24%2F235842&quot; title=&quot;【C#】リストや配列をクラス外に安全に公開する方法 - 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></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-11-24 23:58:42</published>
  <title>【C#】リストや配列をクラス外に安全に公開する方法</title>
  <type>rich</type>
  <url>https://takap-tech.com/entry/2021/11/24/235842</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
