WXMC/.svn/pristine/55/5568e751a746b3a6b9ea5166f8234979ef5f9072.svn-base
2024-12-04 16:18:46 +08:00

51 lines
1.4 KiB
Plaintext

using CommonSerializeDefine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace CommonSerializing
{
public class Serializer : SerializerBase, ISerializer
{
public IEnumerable<KeyValuePair<string, string>> Serialize(Type targetType, object obj)
{
throw new NotImplementedException();
}
public string SerializeData(Type targetType, object data)
{
ITypeSerializer serializer = EnsureSerializer(targetType);
return serializer.Serialize(data, targetType, this);
}
private IEnumerable<FieldInfo> GetFields(Type targetType)
{
foreach (var item in targetType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
{
yield return item;
}
}
//private IEnumerable<KeyValuePair<string, FieldInfo>> FlattenFields(object obj, List<string> stack)
//{
// Type type = obj.GetType();
// foreach (var item in GetFields(type))
// {
// Type fieldType = item.FieldType;
// ITypeSerializer typeSerializer = TryGetSerializer(fieldType);
// if (typeSerializer != null)
// {
// }
// else
// {
// }
// }
//}
}
}