构建List-long的字段值 - BuildListLong
2017-02-26 20:25:39 访问(1360) 赞(0) 踩(0)
/// <summary>
/// 构建List-long的字段值 - BuildListLong
/// </summary>
/// <param name="theList"></param>
/// <param name="listBaseModel"></param>
/// <param name="dataColumnName"></param>
public void BuildListLong
(
List<long> theList,
List<BaseModel> listBaseModel,
string dataColumnName
)
{
if (theList == null)
throw new Exception("List<long> theList == null");
if (listBaseModel == null || listBaseModel.Count == 0)
return;
object oValue = null;
string strValue = "";
long longValue = 0;
foreach (BaseModel model in listBaseModel)
{
if (model == null)
continue;
oValue = model.GetPropertyValue(dataColumnName);
if (oValue == null)
continue;
strValue = oValue.ToString();
if (strValue.Length == 0)
continue;
longValue = long.Parse(strValue);
if (theList.Contains(longValue))
continue;
theList.Add(longValue);
}
}
标签:
构建List-long的字段值 - BuildListLong 


上一条:
下一条:
相关评论
发表评论