当前位置: 首页 > news >正文

网站2个页面做首页软文写作技巧有哪些

网站2个页面做首页,软文写作技巧有哪些,app开发者需要更新此app,试述网站建设的步骤目录 一、使用反射分组 二、不使用反射分组 三、调用示例 四、代码demo 一、使用反射分组 private static ListGroupListT GetGroupListT(ListT entities, string groupByProperty) {// 获取分组字段的类型var propertyInfo typeof(T).…目录 一、使用反射分组 二、不使用反射分组 三、调用示例 四、代码demo 一、使用反射分组 private static ListGroupListT GetGroupListT(ListT entities, string groupByProperty) {// 获取分组字段的类型var propertyInfo typeof(T).GetProperty(groupByProperty);if (propertyInfo null){throw new ArgumentException($类型 {typeof(T).Name} 不包含名为 {groupByProperty} 的属性.);}// 按指定属性分组var groupedEntities entities.GroupBy(e propertyInfo.GetValue(e, null));// 创建分组列表ListGroupListT groupLists new ListGroupListT();foreach (var group in groupedEntities){GroupListT groupList new GroupListT{GroupKey group.Key.ToString(), // 使用分组键作为GroupKeyList group.ToList(), // 分组数据//Count group.Count() //每组数据条数};groupLists.Add(groupList);}return groupLists; } 二、不使用反射分组 private static ListGroupListStudent GetGroupListSimple(ListStudent entities) {// 根据班级分组var groupedStudents entities.GroupBy(s s.ClassNumber);// 创建分组列表ListGroupListStudent groupLists new ListGroupListStudent();foreach (var group in groupedStudents){GroupListStudent groupList new GroupListStudent{GroupKey group.Key.ToString(),List group.ToList(),// Count group.Count()};groupLists.Add(groupList);}return groupLists; } 三、调用示例 //反射获取分组 var result GetGroupList(Students, ClassNumber); //直接获取分组 var result2 GetGroupListSimple(Students); 四、代码demo using System; using System.Collections.Generic; using System.Linq;namespace StudentClassExample {// 学生类public class Student{public string Name { get; set; }public int ClassNumber { get; set; }public Student(string name, int classNumber){Name name;ClassNumber classNumber;}}public class GroupListT{public string GroupKey { get; set; }public int Count { get List.Count; }public ListT List { get; set; } new ListT();}public class GroupListStudent{public string GroupKey { get; set; }public int Count { get List.Count; }public ListStudent List { get; set; } new ListStudent();}// 主程序class Program{static void Main(string[] args){// 创建1班的学生ListStudent Students new ListStudent{new Student(学生1-1, 1),new Student(学生1-2, 1)};// 创建2班的学生ListStudent class2Students new ListStudent{new Student(学生2-1, 2),new Student(学生2-2, 2),new Student(学生2-3, 2)};Students.AddRange(class2Students);//反射获取分组var result GetGroupList(Students, ClassNumber);//直接获取分组var result2 GetGroupListSimple(Students);;}private static ListGroupListT GetGroupListT(ListT entities, string groupByProperty){// 获取分组字段的类型var propertyInfo typeof(T).GetProperty(groupByProperty);if (propertyInfo null){throw new ArgumentException($类型 {typeof(T).Name} 不包含名为 {groupByProperty} 的属性.);}// 按指定属性分组var groupedEntities entities.GroupBy(e propertyInfo.GetValue(e, null));// 创建分组列表ListGroupListT groupLists new ListGroupListT();foreach (var group in groupedEntities){GroupListT groupList new GroupListT{GroupKey group.Key.ToString(), // 使用分组键作为GroupKeyList group.ToList(), // 分组数据//Count group.Count() //每组数据条数};groupLists.Add(groupList);}return groupLists;}private static ListGroupListStudent GetGroupListSimple(ListStudent entities){// 根据班级分组var groupedStudents entities.GroupBy(s s.ClassNumber);// 创建分组列表ListGroupListStudent groupLists new ListGroupListStudent();foreach (var group in groupedStudents){GroupListStudent groupList new GroupListStudent{GroupKey group.Key.ToString(),List group.ToList(),// Count group.Count()};groupLists.Add(groupList);}return groupLists;}} }
http://www.hkea.cn/news/14520912/

相关文章:

  • 土特产网站建设事业计划书网站建设公司开票开什么内容
  • 临沂外贸网站建设个人两字印章在线制作网站
  • 上海网站建设 迈wordpress 花园
  • 做网站编辑怎么样h5神兽平台正规的代理
  • 玉林网站建设公司淮北市官网
  • 做安居客网站需要什么浏览器微信营销网站(含html源文件)免费下载
  • 云南网站建设电话页面紧急情况访问升级
  • 网站设计制作音乐排行榜模板网站建设推广
  • 广东智能网站建设费用表单网站
  • 高唐企业建网站服务商seo属于技术还是营销
  • 米东区做网站wordpress主题 付费
  • 优秀网站设计分析怎么做没有后台程序的网站
  • 网上开店怎么找货源seo关键词库
  • 食品网站建设策划cms与php做网站的区别
  • 公司的网站难不难做有哪些做ppt用图片的网站有哪些问题
  • 黄楼企业建站流程极简网站设计
  • seo自助建站平台做彩票网站都是怎么拉人的
  • 有没有返利网站做京东的网站运营需要++做哪些工作
  • 优惠券网站开发营销型网站郭老师案例分享
  • 太谷网站建设服务器网站建设与营销经验
  • 网站后缀com网络推广公司运作
  • 越南做网站江苏省华建建设股份有限公司网站
  • 广州市白云区建设局 网站中铁快运关于网站建设
  • 网站开发应聘信息做游戏本测评的网站
  • 外贸网站如何推广优化中国电子商务网
  • 巢湖城市建设投资有限公司网站wpf可以做网站吗
  • 制作微信网页的网站wordpress小说系统
  • 自己想做个网站怎么做网站百度云链接
  • 苏州哪家做网站好移动互联网应用开发
  • 福鼎市建设局网站石家庄住房和城乡建设厅网站