refactor: TypeFactory ReloadTypes made multithread friendly

This commit is contained in:
Syntriax 2025-05-04 18:57:01 +03:00
parent 41c5def097
commit b0b421151f

View File

@ -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<string, Type> registeredTypes = [];
private static readonly ConcurrentDictionary<string, Type> registeredTypes = [];
public static string GetTypeName(Type type) => type.FullName ?? throw new ArgumentException($"{type.Name} must be a resolvable type");