public static class ListTools { /// <summary> /// 获取唯一值列表 /// </summary> /// <param name="strList">原始值</param> /// <returns>唯一值</returns> public static List<T> GetUniqueValue<T>(this List<T> list) { List<T> tmp = new List<T>(); for (int i = 0; i < list.Count; i++) { if (!tmp.Contains(list[i])) tmp.Add(list[i]); } return tmp; } }
时间: 2024-10-10 11:29:44