using Newtonsoft.Json;
namespace WebWIPAPI.Utils
{
public class ClassHelper
{
/////
///// 实体互转
/////
///// 新转换的实体
///// 要转换的实体
/////
/////
//public static T RotationMapping(S s)
//{
// T target = Activator.CreateInstance();
// var originalObj = s.GetType();
// var targetObj = typeof(T);
// foreach (PropertyInfo original in originalObj.GetProperties())
// {
// foreach (PropertyInfo t in targetObj.GetProperties())
// {
// if (t.Name == original.Name)
// {
// t.SetValue(target, original.GetValue(s, null), null);
// }
// }
// }
// return target;
//}
public static T RotationMapping_Json(S s)
{
var oldStr = JsonConvert.SerializeObject(s);
return JsonConvert.DeserializeObject(oldStr);
}
}
}