{"id":4814,"date":"2020-03-06T18:00:50","date_gmt":"2020-03-06T09:00:50","guid":{"rendered":"https:\/\/virtualcast.jp\/blog\/?p=4814"},"modified":"2024-10-23T15:35:06","modified_gmt":"2024-10-23T06:35:06","slug":"foreach_gc_alloc","status":"publish","type":"post","link":"https:\/\/blog.virtualcast.jp\/blog\/2020\/03\/foreach_gc_alloc\/","title":{"rendered":"\u3010Unity, C#\u3011foreach \u306e GC Alloc \u6761\u4ef6\u3092\u8abf\u3079\u3066\u307f\u305f"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u958b\u767a\u306e taraba_ \u3067\u3059\u3002<br \/>\n\u4eca\u65e5\u306f\u3001Unity \u4e0a\u3067 .NET \u306e System.Collections.Generic \u540d\u524d\u7a7a\u9593\u306b\u3042\u308b <code>IEnumerable&lt;T&gt;<\/code> \u5b9f\u88c5\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\uff08\u3068\u914d\u5217\uff09\u3092 foreach \u306b\u304b\u3051\u305f\u969b\u306b\u3001GC Alloc \u304c\u767a\u751f\u3059\u308b\u6761\u4ef6\u3092\u8abf\u3079\u307e\u3057\u305f\u3002<br \/>\n\u8abf\u67fb\u74b0\u5883\u306f Unity 2018.4.14f1 \u3067\u3059\u3002<br \/>\n\uff082020.1.0a24 \u3067\u3082\u540c\u69d8\u306e\u7d50\u679c\u3067\u3057\u305f\uff09<\/p>\n<p>\u307e\u305a\u306f\u4ee5\u4e0b\u306e\u7591\u4f3c\u30b3\u30fc\u30c9\u3068\u30d7\u30ed\u30d5\u30a1\u30a4\u30eb\u7d50\u679c\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><code class=\"language-ForeachCheck.cs\">    \/\/ \u76f4\u63a5\u6301\u3064\n    private int[] _array = new[] {1, 2, 3, 4};\n\n    private List&lt;int&gt; _list = new List&lt;int&gt;() {1, 2, 3, 4};\n\n    private Dictionary&lt;int, int&gt; _dictionary = new Dictionary&lt;int, int&gt; {{1, 2}, {3, 4}};\n\n    \/\/ \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3068\u3057\u3066\u6301\u3064\n    private IList&lt;int&gt; _interfacedArray = new[] {1, 2, 3, 4};\n\n    private IList&lt;int&gt; _interfacedList = new List&lt;int&gt; {1, 2, 3, 4};\n\n    private IReadOnlyDictionary&lt;int, int&gt; _interfacedDictionary = new Dictionary&lt;int, int&gt; {{1, 2}, {3, 4}};\n\n    private void Update()\n    {\n        Profiler.BeginSample(&quot;AllocCheck: Array&quot;);\n        foreach (var _ in _array) { }\n        Profiler.EndSample();\n\n        Profiler.BeginSample(&quot;AllocCheck: List&quot;);\n        foreach (var _ in _list) { }\n        Profiler.EndSample();\n\n        Profiler.BeginSample(&quot;AllocCheck: Dictionary&quot;);\n        foreach (var _ in _dictionary) { }\n        Profiler.EndSample();\n\n        Profiler.BeginSample(&quot;AllocCheck: InterfacedArray&quot;);\n        foreach (var _ in _interfacedArray) { }\n        Profiler.EndSample();\n\n        Profiler.BeginSample(&quot;AllocCheck: InterfacedList&quot;);\n        foreach (var _ in _interfacedList) { }\n        Profiler.EndSample();\n\n        Profiler.BeginSample(&quot;AllocCheck: InterfacedDictionary&quot;);\n        foreach (var _ in _interfacedDictionary) { }\n        Profiler.EndSample();\n    }<\/code><\/pre>\n<p><a href=\"https:\/\/virtualcast.jp\/blog\/wp-content\/uploads\/2020\/03\/foreach_interfaced.png\"><img src=\"https:\/\/virtualcast.jp\/blog\/wp-content\/uploads\/2020\/03\/foreach_interfaced.png\" alt=\"\" \/><\/a><br \/>\n<\/p>\n<p>\u73fe\u5728\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u76f4\u63a5 foreach \u306b\u304b\u3051\u305f\u5834\u5408 GC Alloc \u306f\u767a\u751f\u3057\u306a\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3057\u304b\u3057\u3001<code>IList&lt;T&gt;<\/code> \u306a\u3069 <code>IEnumerable&lt;T&gt;<\/code> \u7d99\u627f\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3068\u3057\u3066\u4fdd\u6301\u3057\u3001foreach \u306b\u304b\u3051\u305f\u5834\u5408\u306b\u306f\u767a\u751f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>Unity 5.4 \u4ee5\u524d\u306f <code>List&lt;T&gt;<\/code> \u306a\u3069\u914d\u5217\u4ee5\u5916\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u5bfe\u3057\u3066 foreach \u3092\u884c\u3046\u3068\u3001\u5c55\u958b\u3055\u308c\u305f\u30b3\u30fc\u30c9\u3067\u69cb\u9020\u4f53\u306e IDisposable \u3078\u306e\u30ad\u30e3\u30b9\u30c8\u304c\u767a\u751f\u3057\u3001Boxing \uff08\u306b\u3088\u308b GC Alloc\uff09 \u304c\u8d77\u304d\u3066\u3044\u307e\u3057\u305f\u3002<br \/>\n\uff08GC Alloc \u306e\u30b5\u30a4\u30ba\u306e\u6839\u62e0\u3068\u5b9f\u969b\u306e\u5c55\u958b\u306b\u3064\u3044\u3066\u306f\u3001 <a href=\"http:\/\/neue.cc\/2016\/08\/05_537.html\">http:\/\/neue.cc\/2016\/08\/05_537.html<\/a> \u304c\u8a73\u3057\u3044\u3067\u3059\u3002\uff09<\/p>\n<p>\u73fe\u5728\u305d\u306e\u30b3\u30f3\u30d1\u30a4\u30e9\u306e\u554f\u984c\u306f\u89e3\u6c7a\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3068\u3057\u3066 foreach \u3092\u547c\u3093\u3060\u969b\u3001\u540c\u7b49\u306e GC Alloc \u304c\u767a\u751f\u3057\u3066\u3044\u308b\u3088\u3046\u306b\u898b\u3048\u307e\u3059\u3002<\/p>\n<h4>GC Alloc \u767a\u751f\u5143<\/h4>\n<p>Deep Profiling \u3067\u898b\u3066\u307f\u308b\u3068\u3001\u3053\u306e GC Alloc \u306f GetEnumerator() \u6bb5\u968e\u3067\u767a\u751f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/virtualcast.jp\/blog\/wp-content\/uploads\/2020\/03\/ILIst_DeepProfile.png\"><img src=\"https:\/\/virtualcast.jp\/blog\/wp-content\/uploads\/2020\/03\/ILIst_DeepProfile.png\" alt=\"\" \/><\/a><\/p>\n<p>\u5404\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u4ee3\u8868\u3068\u3057\u3066 <code>List&lt;T&gt;<\/code> \u3092\u4f8b\u306b\u6319\u3052\u307e\u3059\u3002<\/p>\n<p><code>List&lt;T&gt;.GetEnumerator()<\/code> \u3067\u8fd4\u3055\u308c\u308b <code>List&lt;T&gt;.Enumerator<\/code> \u306f\u3001\u30af\u30e9\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\u5074\u3067\u6700\u9069\u5316\u306e\u305f\u3081\u5404\u3005\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u5c02\u7528\u306b\u7528\u610f\u3055\u308c\u305f\u69cb\u9020\u4f53\u3067\u3059\u3002<br \/>\n<a href=\"https:\/\/docs.microsoft.com\/ja-jp\/dotnet\/api\/system.collections.generic.list-1.enumerator?view=netframework-4.8\">https:\/\/docs.microsoft.com\/ja-jp\/dotnet\/api\/system.collections.generic.list-1.enumerator?view=netframework-4.8<\/a><br \/>\n\uff08System.Collections.Generic \u540d\u524d\u7a7a\u9593\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u306f\u5168\u3066\u540c\u69d8\u306e\u5c02\u7528\u69cb\u9020\u4f53\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\uff09<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u76f4\u63a5 GetEnumerator() \u3092\u547c\u3093\u3060\u5834\u5408\u306f GC Alloc \u304c\u8d77\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u4e00\u65b9\u3001<code>IList&lt;T&gt;.GetEnumerator()<\/code> \u306a\u3069 <code>IEnumerable&lt;T&gt;<\/code> \u306e\u7d99\u627f\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306f <code>IEnumerator&lt;T&gt;<\/code> \u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<p>List.cs \u3092\u8997\u3044\u3066\u307f\u308b\u3068\u3001<code>IEnumerable&lt;T&gt;.GetEnumerator()<\/code> \u306e\u5b9f\u88c5\u306f<\/p>\n<pre><code>        IEnumerator&lt;T&gt; IEnumerable&lt;T&gt;.GetEnumerator() \n        {\n            return new Enumerator(this);\n        }\n<\/code><\/pre>\n<p><a href=\"https:\/\/referencesource.microsoft.com\/#mscorlib\/system\/collections\/generic\/list.cs,574\">https:\/\/referencesource.microsoft.com\/#mscorlib\/system\/collections\/generic\/list.cs,574<\/a><br \/>\n\u3068\u306a\u3063\u3066\u304a\u308a\u3001\u6697\u9ed9\u7684\u306b\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3078\u306e\u30ad\u30e3\u30b9\u30c8\u304c\u767a\u751f\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\uff08\u7701\u7565\u305b\u305a\u306b\u66f8\u3044\u305f\u5834\u5408\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\uff09<\/p>\n<pre><code>return (IEnumerator&lt;T&gt;) new List&lt;T&gt;.Enumerator(this)<\/code><\/pre>\n<p>\u3053\u306e Boxing \u304c\u3001\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3068\u3057\u3066\u4fdd\u6301\u3057\u3001foreach \u306b\u304b\u3051\u305f\u5834\u5408\u306e GC Alloc \u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><code>IEnumerator&lt;T&gt;<\/code> \u306f IDisposable \u3092\u7d99\u627f\u3057\u3066\u304a\u308a\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u4ed5\u69d8\u306b\u4e0d\u5177\u5408\u304c\u3042\u3063\u305f\u3053\u308d\u306e\u3088\u3046\u306b IDiposable \u3078\u306e\u30ad\u30e3\u30b9\u30c8\u306b\u3088\u308b Boxing \u306f\u767a\u751f\u3057\u3066\u3044\u307e\u305b\u3093\u3002<br \/>\n\uff08\u540c\u30b5\u30a4\u30ba\u306e Boxing \u304c\u767a\u751f\u3057\u3066\u3044\u308b\u305f\u3081\u540c\u3058\u306b\u898b\u3048\u307e\u3059\u304c\uff09<\/p>\n<p>\u8981\u7d20\u304c struct\uff08primitive\uff09 \u3067\u3042\u308b\u304b\u3001class \u3067\u3042\u308b\u304b\u306f GC Alloc \u306e\u767a\u751f\u306b\u306f\u7121\u95a2\u4fc2\u3067\u3057\u305f\u3002<br \/>\n\u307e\u305f\u3001\u5f8c\u8ff0\u306e Sorted \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u4ee5\u5916\u3001\u8981\u7d20\u6570\u3068 GC Alloc \u306e\u767a\u751f\u306f\u7121\u95a2\u4fc2\u3067\u3057\u305f\u3002<\/p>\n<h5>\u4f8b\u59161: \u914d\u5217<\/h5>\n<p>\u914d\u5217\uff08\u3068 <code>Span&lt;T&gt;<\/code>\uff09\u306b\u5bfe\u3059\u308b foreach \u306f\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u304c\u898b\u3064\u3051\u6b21\u7b2c for \u6587\u3068\u540c\u7b49\u306e\u30b3\u30fc\u30c9\u306b\u5909\u63db\u3057\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\n\u3057\u304b\u3057\u3001\u914d\u5217\u3092\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3068\u3057\u3066\u6301\u3064\u5834\u5408\u306b\u306f\u30b3\u30f3\u30d1\u30a4\u30e9\u304c\u5224\u65ad\u3067\u304d\u305a\u3001\u305d\u306e\u307b\u304b\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u540c\u69d8\u306b\u5c55\u958b\u3055\u308c GetEnumerator() \u304c\u547c\u3070\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u914d\u5217\u306f System.Collections.Generic \u540d\u524d\u7a7a\u9593\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u3067\u306f\u306a\u304f\u3001\u8a00\u8a9e\u4ed5\u69d8\u3068\u3057\u3066\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u304b\u3001 GetEnumerator() \u3067\u8fd4\u3055\u308c\u308b\u5c02\u7528\u306e\u69cb\u9020\u4f53\u306f\u7528\u610f\u3055\u308c\u3066\u304a\u3089\u305a\u3001Array.GetEnumerator() \u5185\u90e8\u3067\u306f\u30af\u30e9\u30b9\u304c new \u3055\u308c\u3001IEnumerator \u3068\u3057\u3066\u8fd4\u3055\u308c\u307e\u3059\uff08int[] \u306e\u5834\u5408 32B \u306e GC Alloc \u304c\u767a\u751f\u3057\u307e\u3059\uff09\u3002<br \/>\n\u4f8b\u5916\u3068\u3057\u305f\u306e\u306f\u3001 Boxing \u306b\u3088\u308b GC Alloc \u3067\u306f\u306a\u304f\u4ed6\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306b\u6bd4\u3079\u308b\u3068\u30b3\u30b9\u30c8\u304c\u5b89\u3044\u306e\u3068\u3001\u76f4\u63a5 Array.GetEnumerator() \u3092\u547c\u3093\u3060\u3060\u3051\u3067\u3082 GC Alloc \u304c\u767a\u751f\u3059\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n<h5>\u4f8b\u59162: Sorted \u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/h5>\n<p>\u4ee3\u8868\u3068\u3057\u3066 <code>SortedDictionary&lt;TKey, TValue&gt;<\/code> \u3092\u4f8b\u306b\u6319\u3052\u307e\u3059\u3002<\/p>\n<p>SortedDictionary&lt;&gt; \u306b\u3082 GetEnumerator() \u7528\u306b\u5c02\u7528\u306e\u69cb\u9020\u4f53\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3057\u304b\u3057\u3001 GetEnumerator() \u3092\u547c\u3093\u3060\u6642\u70b9\u3067 GC Alloc \u304c\u767a\u751f\u3057\u3001\u767b\u9332\u3055\u308c\u3066\u3044\u308b KeyValuePair \u304c\u591a\u3044\u307b\u3069 GC Alloc \u91cf\u3082 16B \u523b\u307f\u3067\u5897\u3048\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3068\u3057\u3066\u4fdd\u6301\u3057 GetEnumerator() \u3092\u547c\u3076\u3068\u3055\u3089\u306b\u8ffd\u52a0\u3067 64B \u5206\u306e Boxing \u304c\u767a\u751f\u3057\u307e\u3059\u3002<br \/>\nSorted \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u5185\u90e8\u306e\u6df1\u8ffd\u3044\u306f\u3053\u306e\u8a18\u4e8b\u3067\u306f\u907f\u3051\u307e\u3059\u304c\u3001\u4ee5\u4e0b\u306b\u8a08\u6e2c\u7528\u30b9\u30af\u30ea\u30d7\u30c8\u3068 DeepProfiling \u7d50\u679c\u3092\u7f6e\u3044\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<pre><code>    private SortedDictionary&lt;int, int&gt; _sortedDictionary = new SortedDictionary&lt;int, int&gt;(){{1,1}};\n\n    private IDictionary&lt;int, int&gt; _interfacedSortedDictionary = new SortedDictionary&lt;int, int&gt;(){{1,1}};\n\n    private SortedDictionary&lt;int, int&gt; _sortedDictionary20 = new SortedDictionary&lt;int, int&gt;()\n    {\n        {1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 21}, {31, 41}, {51, 6}, {71, 8}, {91, 10},\n        {331, 2}, {33333, 4}, {55555555, 6}, {323332327, 8}, {462229, 10}, {122221, 21}, {3322, 41}, {2251, 6},\n        {2323271, 8}, {93331, 10}\n    };\n\n    private void Update()\n    {\n        Profiler.BeginSample(&quot;AllocCheck: SortedDictionaryEnumerator&quot;);\n        _sortedDictionary.GetEnumerator();\n        Profiler.EndSample();\n\n        Profiler.BeginSample(&quot;AllocCheck: InterfacedSortedDictionaryEnumerator&quot;);\n        _interfacedSortedDictionary.GetEnumerator();\n        Profiler.EndSample();\n\n        Profiler.BeginSample(&quot;AllocCheck: SortedDictionaryEnumerator20&quot;);\n        _sortedDictionary20.GetEnumerator();\n        Profiler.EndSample();\n    }<\/code><\/pre>\n<p><a href=\"https:\/\/virtualcast.jp\/blog\/wp-content\/uploads\/2020\/03\/SortedDictionary.png\"><img src=\"https:\/\/virtualcast.jp\/blog\/wp-content\/uploads\/2020\/03\/SortedDictionary-1024x482.png\" alt=\"\" \/><\/a><\/p>\n<p>\uff08\u2191\u306e\u96d1\u306a\u5185\u8a33\uff09<\/p>\n<pre><code>&lt;int, int&gt; \u306e\u5834\u5408\u3067\n\u8981\u7d201: 104B\n\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u7d4c\u7531\u3067\u8981\u7d201: 104 + 64 = 168B\n\u8981\u7d2020 : 152B \uff08104 + 16 * 3\uff09<\/code><\/pre>\n<h4>\u307e\u3068\u3081<\/h4>\n<ul>\n<li>\n<p>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3068\u3057\u3066\u4fdd\u6301\u3059\u308b\u3068\u3001foreach \u6642\u306b GC Alloc \u304c\u767a\u751f\u3059\u308b<\/p>\n<ul>\n<li>\u914d\u5217: \u666e\u901a\u306e Heap Allocation \u304c\u8d77\u304d\u308b<\/li>\n<li>System.Collections.Generic \u4e0b\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3: Boxing \u304c\u8d77\u304d\u308b<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Sorted \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u305d\u306e\u307e\u307e foreach \u306b\u304b\u3051\u308b\u3060\u3051\u3067 GC Alloc \u304c\u767a\u751f\u3059\u308b<\/p>\n<\/li>\n<\/ul>\n<h4>\u3069\u3046\u5bfe\u51e6\u3059\u308c\u3070\u3044\u3044\u304b<\/h4>\n<ul>\n<li>\n<p>\u30af\u30e9\u30b9\u5185\u90e8\u306b\u9589\u3058\u305f\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u5316\u305b\u305a\u306b\u4fdd\u6301\u3059\u308b<\/p>\n<ul>\n<li>VirtualCast \u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u958b\u767a\u3067\u306f\u3053\u306e\u65b9\u91dd\u306b\u3057\u3066\u3044\u307e\u3059<\/li>\n<li>\u30af\u30e9\u30b9\u5916\u306b\u516c\u958b\u3059\u308b\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f\u7528\u9014\u306b\u5fdc\u3058\u3066\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3068\u3057\u3066\u516c\u958b\u3059\u308b\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u6bce\u30d5\u30ec\u30fc\u30e0 foreach \u3059\u308b\u3082\u306e\u306f\u8a31\u5bb9\u3057\u307e\u305b\u3093<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Rider \u306e possible object allocation \u8b66\u544a\u304c\u51fa\u3066\u3044\u308b\u5834\u6240\u3092\u3055\u3089\u3046<br \/>\nRider \u3084 ReShaper \u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u6642\u9650\u5b9a\u3067\u3059\u304c\u3001\u4ee5\u4e0b\u306e\u8b66\u544a\u304c\u51fa\u3066\u3044\u308b\u5834\u6240\u306e\u53c2\u7167\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u305f\u3069\u308b\u3068\u898b\u3064\u3051\u3084\u3059\u3044\u3068\u601d\u308f\u308c\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/virtualcast.jp\/blog\/wp-content\/uploads\/2020\/03\/2020-03-05_13h21_39.png\"><img src=\"https:\/\/virtualcast.jp\/blog\/wp-content\/uploads\/2020\/03\/2020-03-05_13h21_39.png\" alt=\"\" \/><\/a><br \/>\n\u203b SortedList&lt;&gt; \u3092 foreach \u306b\u304b\u3051\u3088\u3046\u3068\u3059\u308b\u3068\u8b66\u544a\u304c\u51fa\u307e\u3057\u305f\u304c\u3001SortedSet&lt;&gt;, SortedDictionary&lt;&gt; \u3067\u306f\u51fa\u306a\u304b\u3063\u305f\u306e\u3067\u53c2\u8003\u7a0b\u5ea6\u306b<\/p>\n<\/li>\n<li>\n<p>Sorted \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306f foreach \u306b\u304b\u3051\u306a\u3044<\/p>\n<\/li>\n<\/ul>\n<h5>\u4ed6\u53c2\u8003\u306b\u3057\u305f\u8a18\u4e8b<\/h5>\n<p><a href=\"https:\/\/ufcpp.net\/blog\/2018\/12\/howtoenumerate\/\">https:\/\/ufcpp.net\/blog\/2018\/12\/howtoenumerate\/<\/a><br \/>\n<a href=\"https:\/\/ufcpp.net\/blog\/2018\/12\/devirtualization\/\">https:\/\/ufcpp.net\/blog\/2018\/12\/devirtualization\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u958b\u767a\u306e taraba_ \u3067\u3059\u3002 \u4eca\u65e5\u306f\u3001Unity \u4e0a\u3067 .NET \u306e System.Collections.Generic \u540d\u524d\u7a7a\u9593\u306b\u3042\u308b IEnumerable&lt;T&gt; \u5b9f\u88c5\u30b3\u30ec\u30af\u30b7...<\/p>\n","protected":false},"author":37,"featured_media":4972,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[111,26],"tags":[23],"_links":{"self":[{"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/posts\/4814"}],"collection":[{"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/comments?post=4814"}],"version-history":[{"count":22,"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/posts\/4814\/revisions"}],"predecessor-version":[{"id":4973,"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/posts\/4814\/revisions\/4973"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/media\/4972"}],"wp:attachment":[{"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/media?parent=4814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/categories?post=4814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.virtualcast.jp\/blog\/wp-json\/wp\/v2\/tags?post=4814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}