PageConfig/PageEntityManager.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Reflection;
namespace Printer.Cs.PageEntityInfo
{
public class PageEntityManager<T>where T:class,new()
{
public static T Getentity(XmlNode node)
{
T t = new T();
PropertyInfo[] properties = t.GetType().GetProperties();
foreach (XmlAttribute item in node.Attributes)
{
foreach (PropertyInfo p in properties)
{
if (p.Name.ToUpper() == item.Name.ToUpper())
{
switch (p.PropertyType.Name)
{
case "Int32":
p.SetValue(t, Convert.ToInt32(item.Value), null);
break;
case "Decimal":
p.SetValue(t, Convert.ToDecimal(item.Value), null);
break;
default:
p.SetValue(t, Convert.ToString(item.Value), null);
break;
}
}
}
}
return t;
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。