From c84f62897cc17d60b6bed1d27fc66734bfe883ea Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Wed, 1 Apr 2026 12:47:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(config):=20=E4=BC=98=E5=8C=96YAML?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=A8=A1=E5=BC=8F=E9=AA=8C=E8=AF=81=E5=99=A8?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=85=81=E8=AE=B8=E5=80=BC=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将传统的空值检查和计数判断替换为更简洁的模式匹配语法 - 使用集合表达式简化代码结构,提高可读性 - 保持原有的功能逻辑不变,仅优化代码风格 --- GFramework.Game/Config/YamlConfigSchemaValidator.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GFramework.Game/Config/YamlConfigSchemaValidator.cs b/GFramework.Game/Config/YamlConfigSchemaValidator.cs index 67dbed7..857d960 100644 --- a/GFramework.Game/Config/YamlConfigSchemaValidator.cs +++ b/GFramework.Game/Config/YamlConfigSchemaValidator.cs @@ -398,8 +398,7 @@ internal static class YamlConfigSchemaValidator if (isValid) { var normalizedValue = NormalizeScalarValue(expectedType, value); - if (allowedValues != null && - allowedValues.Count > 0 && + if (allowedValues is { Count: > 0 } && !allowedValues.Contains(normalizedValue, StringComparer.Ordinal)) { var enumSubject = isArrayItem