You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using HcUtility.Core;
namespace DSWeb.TruckMng.Helper
{
public class ModelObjectConvert<T> where T:ModelObjectBase
{
private static ModelObjectBase Converter(T inputObject)
{
return inputObject;
}
public static List<ModelObjectBase> ToModelObjectList(List<T> objList)
{
if (objList == null)
return null;
return objList.ConvertAll<ModelObjectBase>(new Converter<T, ModelObjectBase>(Converter));
}
public static List<Dictionary<string, string>> ToExtendList(List<T> objList)
{//将扩展数据属性的对象列表中的扩展属性值转化为List<Dictionary<string, string>>
if (objList == null)
return null;
else
{
var result = new List<Dictionary<string, string>>();
foreach (var obj in objList)
{
result.Add(obj.ExtendDic);
}
return result;
}
}
}
}