Util/DataHelper.cs
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace Util
{
public class DataHelper
{
#region static method GetValue
/// <summary>
/// Gets specified field value from the specified DataRowView.
/// </summary>
/// <param name="dr">DataRowView from where to get value.</param>
/// <param name="fieldName">Field name in DataRowView.</param>
/// <returns>Returns specified field value.</returns>
public static object GetValue(DataRow dr, string fieldName)
{
if (dr == null)
{
throw new ArgumentNullException("dr");
}
if (fieldName == null)
{
throw new ArgumentNullException("fieldName");
}
if (fieldName == "")
{
throw new ArgumentException("Argument 'fieldName' value must be specified.");
}
if (!dr.Table.Columns.Contains(fieldName))
{
throw new ArgumentException("Specified fieldName '" + fieldName + "' does not exist in table '" + dr.Table.TableName + "'.");
}
return dr[fieldName];
}
/// <summary>
/// Gets specified field value from the specified DataRowView.
/// </summary>
/// <param name="dr">DataRowView from where to get value.</param>
/// <param name="fieldName">Field name in DataRowView.</param>
/// <returns>Returns specified field value.</returns>
public static object GetValue(DataRowView dr, string fieldName)
{
if (dr == null)
{
throw new ArgumentNullException("dr");
}
if (fieldName == null)
{
throw new ArgumentNullException("fieldName");
}
if (fieldName == "")
{
throw new ArgumentException("Argument 'fieldName' value must be specified.");
}
后面还有 253 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
