您的位置:首页 > 其它

Ilist<T>转换为List<T>

2013-03-29 17:03 344 查看
// **//// <summary>

/// 转换IList<T>为List<T>

/// </summary>

/// <typeparam name="T">指定的集合中泛型的类型</typeparam>

/// <param name="gbList">需要转换的IList</param>

/// <returns></returns>

public static List<T> ConvertIListToList<T>(IList<T> gbList) where T : class

{

if (gbList != null && gbList.Count >= 1)

{

List<T> list = new List<T>();

for (int i = 0; i < gbList.Count; i++)

{

T temp = gbList[i] as T;

if (temp != null)

list.Add(temp);

}

return list;

}

return null;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: