From add6423b2491695823a81ce25e8946b04482209c Mon Sep 17 00:00:00 2001 From: Marc Hernandez Date: Sat, 16 Jan 2021 17:32:40 -0800 Subject: [PATCH] Properly add value to array --- reflect/refl.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reflect/refl.cs b/reflect/refl.cs index eebb8f3..d4101d2 100644 --- a/reflect/refl.cs +++ b/reflect/refl.cs @@ -5,6 +5,7 @@ using System.Collections.Immutable; using System.Linq; using System.Reflection; using System.Text; +using System.Threading; using System.Threading.Tasks; @@ -156,7 +157,7 @@ static public class refl var immList = list.ToImmutableList(); - s_fieldCache = s_fieldCache.Add( t, immList ); + Interlocked.Exchange( ref s_fieldCache, s_fieldCache.Add( t, immList ) ); return immList; }