From b0b421151f8d124b39a294667125235108630f54 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sun, 4 May 2025 18:57:01 +0300 Subject: [PATCH] refactor: TypeFactory ReloadTypes made multithread friendly --- Engine.Core/Factory/TypeFactory.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Engine.Core/Factory/TypeFactory.cs b/Engine.Core/Factory/TypeFactory.cs index d84d5de..aa770e1 100644 --- a/Engine.Core/Factory/TypeFactory.cs +++ b/Engine.Core/Factory/TypeFactory.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -6,7 +7,7 @@ namespace Syntriax.Engine.Core.Factory; public static class TypeFactory { - private static readonly Dictionary registeredTypes = []; + private static readonly ConcurrentDictionary registeredTypes = []; public static string GetTypeName(Type type) => type.FullName ?? throw new ArgumentException($"{type.Name} must be a resolvable type");