From 5270a19e444eec071da0ee0148442acc8132e7c2 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Thu, 18 Dec 2025 08:35:09 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ioc):=20=E7=AE=80=E5=8C=96=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E6=B3=A8=E5=85=A5=E5=AE=B9=E5=99=A8=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=88=9D=E5=A7=8B=E5=8C=96=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用集合表达式替代显式创建List实例 - 统一代码风格,提高可读性 - 减少不必要的类型声明冗余 - [no tag] --- GFramework.Core/ioc/IocContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GFramework.Core/ioc/IocContainer.cs b/GFramework.Core/ioc/IocContainer.cs index d15661e..1ec53d6 100644 --- a/GFramework.Core/ioc/IocContainer.cs +++ b/GFramework.Core/ioc/IocContainer.cs @@ -32,7 +32,7 @@ public class IocContainer $"Singleton already registered for type: {type.Name}"); } - _instances[type] = new List { instance! }; + _instances[type] = [instance!]; } /// @@ -82,7 +82,7 @@ public class IocContainer { if (!_instances.TryGetValue(type, out var list)) { - list = new List(); + list = []; _instances[type] = list; }