(client) feat:添加数据序列化相关代码 (#37)

Co-authored-by: zzdxxz <2079238449@qq.com>
Co-committed-by: zzdxxz <2079238449@qq.com>
This commit is contained in:
2025-07-16 13:05:04 +08:00
committed by TheRedApricot
parent 55cf9d954e
commit ffeb65ba6b
11 changed files with 2407 additions and 25 deletions

View File

@ -343,23 +343,6 @@ namespace Data
// 如果字段的类型直接是基类或其派生类,则返回 true
return fieldType != baseType && baseType.IsAssignableFrom(fieldType);
}
/// <summary>
/// 检查字段的类型是否继承自指定的类
/// </summary>
/// <param name="field">字段信息</param>
/// <param name="baseType">要检查的基类类型</param>
/// <returns>如果字段的类型是基类或其派生类,则返回 true</returns>
public static bool IsFieldTypeInheritedFrom(FieldInfo field, Type baseType)
{
// 获取字段的类型
var fieldType = field.FieldType;
// 如果字段的类型为 null 或不是基类的派生类,则返回 false
if (!baseType.IsAssignableFrom(fieldType))
return false;
// 如果字段的类型直接是基类或其派生类,则返回 true
return fieldType != baseType && baseType.IsAssignableFrom(fieldType);
}
}
}