[netMarketing类库] listHelper类: List数据类型辅助处理类


命名空间:sharClass.listHelper

功能:List数据类型辅助处理类


功能详细说明:

这个类封装了方便处理List列表的一些方法。

注意这些函数参数中有this关键字,说明它们是扩展方法。

扩展方法的调用方式跟List对象自身的方法调用是一样的。

例如:

var list1=new List<string>();
list1.Add("world");
list1.Add("hello");
MessageBox.Show(list1.getNewLineString());


常用函数列表

/// 一维List转二维数组, 因为二维数据定义后赋值比较麻烦,可以用本方法把一个list数据转为一个二维数组
public static T[,] listToArray2<T>(this List<T> data, int columns)
/// 返回指定列数据,出错返回null
public static List<T> getColumnData<T>(this List<T> data,int columns,int selColNo)
/// 返回指定行数据,出错返回null
public static List<T> getRowData<T>(this List<T> data, int columns, int selRowNo)
/// 由中值分类数据, 小于中值的分类型Item1,大于中值的分类到Item2
public static Tuple<List<T>, List<T>> classifyDataByMidValue<T>(this List<T> list, double midData)
/// 求List的平均值
public static double avg<T>(this List<T> data)
/// 取数值类型List列表的最大元素值
public static T max<T>(this List<T> data)
/// T数组转List T
public static List<T> toList<T>(this T[] data)
/// 求T数组的最大元素
public static T max<T>(this T[] data)
/// 取数值类型List列表的最小元素
public static T min<T>(this List<T> data)
/// 取数值类型T数组的最小元素
public static T min<T>(this T[] data)
/// 生成List,值的逗号分隔字符串
public static string getCommaString<T>(this List<T> data)
//   生成List,值的换行分隔的字符串
public static string getNewLineString<T>(this List<T> data)
/// 把二维List转为一维数据结构
 public static IList<Queue<double>> ListToQueue(this List<List<double>> data)
/// 取二维List最大值
public static double getMax(this List<List<double>> data)
///  取二维List最小值
public static double getMin(this List<List<double>> data)
/// 取按列排序的数据列表. 一般数据按行读取,如果要按列统计则可调用本函数,取得列排列的数据列表
public static List<List<double>> GetVerticalData(this List<List<double>> data)
/// 把二维的Queue转为List
public static List<List<double>> QueueToList(this IList<Queue<double>> data)

--------------------- 

作者:hackpig
来源:www.skcircle.com
版权声明:本文为博主原创文章,转载请附上博文链接!

返回类库功能说明目录


本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

会员中心
搜索
«    2024年4月    »
1234567
891011121314
15161718192021
22232425262728
2930
网站分类
标签列表
最新留言
    热门文章 | 热评文章 | 随机文章
文章归档
友情链接
  • 订阅本站的 RSS 2.0 新闻聚合
  • 扫描加本站机器视觉QQ群,验证答案为:halcon勇哥的机器视觉
  • 点击查阅微信群二维码
  • 扫描加勇哥的非标自动化群,验证答案:C#/C++/VB勇哥的非标自动化群
  • 扫描加站长微信:站长微信:abc496103864
  • 扫描加站长QQ:
  • 扫描赞赏本站:
  • 留言板:

Powered By Z-BlogPHP 1.7.2

Copyright Your skcircle.com Rights Reserved.

鄂ICP备18008319号


站长QQ:496103864 微信:abc496103864