code/Athena0.0.1/common/Util/DataHelper.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Athena.common.Util
{
/// <summary>
/// 数据源转换
/// </summary>
public class DataHelper
{
#region IList如何转成List<T>
/// <summary>
/// IList如何转成List<T>
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="list"></param>
/// <returns></returns>
public static List<T> IListToList<T>(IList list)
{
T[] array = new T[list.Count];
list.CopyTo(array, 0);
return new List<T>(array);
}
#endregion
#region DataTable根据条件过滤表的内容
/// <summary>
/// 根据条件过滤表的内容
/// </summary>
/// <param name="dt"></param>
/// <param name="condition"></param>
/// <returns></returns>
public static DataTable DataFilter(DataTable dt, string condition)
{
if (DataHelper.IsExistRows(dt))
{
if (condition.Trim() == "")
{
return dt;
}
else
{
DataTable newdt = new DataTable();
newdt = dt.Clone();
DataRow[] dr = dt.Select(condition);
for (int i = 0; i < dr.Length; i++)
{
newdt.ImportRow((DataRow)dr[i]);
}
return newdt;
}
}
else
{
return null;
后面还有 154 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
