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

山东建设管理局官方网站营销图片大全

山东建设管理局官方网站,营销图片大全,学做网站能赚多少,北京c2b网站建设场景 Java8新特性-Stream对集合进行操作的常用API: Java8新特性-Stream对集合进行操作的常用API_streamapi操作集合_霸道流氓气质的博客-CSDN博客 上面讲的是在Java中使用Stream中对集合的常用操作。 在C#中Linq是有对应的类似的api。 完整和详细的用法可自行查…

场景

Java8新特性-Stream对集合进行操作的常用API:

Java8新特性-Stream对集合进行操作的常用API_streamapi操作集合_霸道流氓气质的博客-CSDN博客

上面讲的是在Java中使用Stream中对集合的常用操作。

在C#中Linq是有对应的类似的api。

完整和详细的用法可自行查阅文档,下面记录使用过程中的一些非常规操作。

注:

博客:
霸道流氓气质的博客_CSDN博客-C#,架构之路,SpringBoot领域博主

实现

1、Where条件筛选

需要自定义筛选规则,筛选函数需要调用一些三方工具类

                    var keyList = keys.Where(key =>{CarVo car = redis.StringGet<CarVo>(key);PointF point = new PointF(Convert.ToSingle(car.x), Convert.ToSingle(car.y));bool result = GisHelper.isPointInPolygon(point, waitingRoomPoints);return result;});

比如这里是校验坐标是否在指定区域内,用到的GisHelper是工具类,附工具类实现

        public static bool isPointInPolygon(PointF point ,PointF[] points) {GraphicsPath myGraphicsPath = new GraphicsPath();Region myRegion = new Region();myGraphicsPath.Reset();myGraphicsPath.AddPolygon(points);myRegion.MakeEmpty();myRegion.Union(myGraphicsPath);//返回判断点是否在多边形里bool result = myRegion.IsVisible(point);return result;}

2、Select自定义映射规则,实现调用三方方法

模糊搜索到redis中的key的集合,遍历这些key,并映射到key对应的value的集合

                        var carVoList = keyList.Select(key =>{CarVo car = redis.StringGet<CarVo>(key);return car;})

这里用的方法可以参考如下连接redis并存取数据的实现

Winform/Csharp中使用StackExchange.Redis连接Redis存取数据并序列化对象/反序列化(支持redis key 模糊搜索):

Winform/Csharp中使用StackExchange.Redis连接Redis存取数据并序列化对象/反序列化(支持redis key 模糊搜索)_霸道流氓气质的博客-CSDN博客

3、OrderBy自定义排序规则,先按照实体的某个属性,再按照另一个属性

                        var carVoList = keyList.Select(key =>{CarVo car = redis.StringGet<CarVo>(key);return car;})//先按照车辆类型排序.OrderBy(a =>{//人车排在最前面if (a.carType.Equals("1")){return 1;}//指挥车排在第二位else if (a.carType.Equals("3")){return 2;}//其他车辆排在后面else{return 3;}})//其次按照车牌号字段排序.ThenBy(a => a.carNumber);

比如这里从redis中查询到数据之后,解析到对象,并先根据对象的carType进行排序,

如果类型为1则排在最前面,类型是3,排在第二优先级,其他的类型排在后面,然后

在每个类型中再按照车牌号这个字段排序。

这里的return 1,数字越小优先级越高。

4、Select映射时从一个对象,映射到另一个对象,并新增一个递增的序号字段

                int numberIndex = 1;var carVoListWithFixedData = carVoList.Select(carVo =>{ResultVo resultVo = new ResultVo{                     number = numberIndex++,carNumber = carVo.carNumber,};resultVo.team = "测试班组";resultVo.direction = "测试方向";return resultVo;});

5、linq select 左外连接

包含左边的表的所有行,如果右边表中某行没有匹配,该行内容为空NULL。

                            var query = from carVo in resultsjoin mail in mailList on carVo.carNumber equals mail.car_number into result1from result in result1.DefaultIfEmpty()select new ResultVo(carVo.number, carVo.team, carVo.direction, carVo.carNumber, result == default(BusMailList) ? String.Empty : result.driver_name);results = query.ToList();

这里以左边results的结果为主,results有多少条则最终会有多少条。

根据results中每个对象的car_number属性去匹配在mailList中与car_number相等的数据的driver_name属性,如果有则匹配显示,

没有则未空,并将最终结果映射到新的对象。

这里的BusMailList就是mailList的每个对象。

附这里的mailList集合的每个对象BusMailList的类

    public class BusMailList{public long binding_time { get; set; }public string car_number { get; set; }public string driver_name { get; set; }public string driver_number { get; set; }public int id { get; set; }public long update_time { get; set; }}

以及results集合的每个对象ResultVo的类

    class ResultVo{[Description("序号")]public int number { get; set; }[Description("班组")]public string team { get; set; }[Description("方向")]public string direction { get; set; }[Description("车号")]public string carNumber { get; set; }[Description("司机")]public string driver { get; set; }public ResultVo(){}public ResultVo(int _number, string _carNumber, string _driver){number = _number;carNumber = _carNumber;driver = _driver;}public ResultVo(int _number, string _carNumber){number = _number;carNumber = _carNumber;}public ResultVo( string _carNumber, string _driver){          carNumber = _carNumber;driver = _driver;}public ResultVo(int _number,string _team,string _direction,string _carNumber,string _driver){number = _number;team = _team;direction = _direction;carNumber = _carNumber;driver = _driver;}}


文章转载自:
http://muumuu.bnpn.cn
http://recumbency.bnpn.cn
http://tainan.bnpn.cn
http://realist.bnpn.cn
http://necessitate.bnpn.cn
http://skilled.bnpn.cn
http://asymptotic.bnpn.cn
http://empurple.bnpn.cn
http://mint.bnpn.cn
http://aimlessly.bnpn.cn
http://stumblingly.bnpn.cn
http://sandbank.bnpn.cn
http://boatmanship.bnpn.cn
http://aerostat.bnpn.cn
http://baghdad.bnpn.cn
http://swum.bnpn.cn
http://quillet.bnpn.cn
http://thickback.bnpn.cn
http://wouldst.bnpn.cn
http://addresser.bnpn.cn
http://redden.bnpn.cn
http://astrodome.bnpn.cn
http://areology.bnpn.cn
http://antipodes.bnpn.cn
http://mandibular.bnpn.cn
http://faconne.bnpn.cn
http://ungula.bnpn.cn
http://hypermnesis.bnpn.cn
http://indology.bnpn.cn
http://bedfordshire.bnpn.cn
http://millirem.bnpn.cn
http://spaggers.bnpn.cn
http://eruption.bnpn.cn
http://heliskiing.bnpn.cn
http://quilimane.bnpn.cn
http://soporific.bnpn.cn
http://sheldon.bnpn.cn
http://granulometric.bnpn.cn
http://uraninite.bnpn.cn
http://alpargata.bnpn.cn
http://offhand.bnpn.cn
http://stt.bnpn.cn
http://indisposed.bnpn.cn
http://thought.bnpn.cn
http://louvar.bnpn.cn
http://kirghiz.bnpn.cn
http://rollock.bnpn.cn
http://jrc.bnpn.cn
http://detour.bnpn.cn
http://habitant.bnpn.cn
http://froe.bnpn.cn
http://cyclonet.bnpn.cn
http://circuit.bnpn.cn
http://winey.bnpn.cn
http://sweptback.bnpn.cn
http://orchidectomy.bnpn.cn
http://ossian.bnpn.cn
http://nodical.bnpn.cn
http://lamarckian.bnpn.cn
http://gusty.bnpn.cn
http://bicol.bnpn.cn
http://neoplasty.bnpn.cn
http://surrogateship.bnpn.cn
http://vedic.bnpn.cn
http://lexics.bnpn.cn
http://megilp.bnpn.cn
http://protist.bnpn.cn
http://acold.bnpn.cn
http://systematization.bnpn.cn
http://unambiguously.bnpn.cn
http://bleach.bnpn.cn
http://obduct.bnpn.cn
http://procrustean.bnpn.cn
http://purl.bnpn.cn
http://counteroffensive.bnpn.cn
http://thrasher.bnpn.cn
http://stripy.bnpn.cn
http://weediness.bnpn.cn
http://footer.bnpn.cn
http://fear.bnpn.cn
http://parcelgilt.bnpn.cn
http://incipience.bnpn.cn
http://biogeocenose.bnpn.cn
http://pennon.bnpn.cn
http://radial.bnpn.cn
http://notable.bnpn.cn
http://sleigh.bnpn.cn
http://broomstick.bnpn.cn
http://extubate.bnpn.cn
http://profuse.bnpn.cn
http://scepsis.bnpn.cn
http://shyster.bnpn.cn
http://biotope.bnpn.cn
http://synsemantic.bnpn.cn
http://wismar.bnpn.cn
http://francium.bnpn.cn
http://france.bnpn.cn
http://crippledom.bnpn.cn
http://lasque.bnpn.cn
http://scrophulariaceous.bnpn.cn
http://www.dt0577.cn/news/124843.html

相关文章:

  • 对对联的网站推广优化
  • 政府网站建设管理典型材料网站建设网站定制
  • 网站建设预期达到的效果网络营销就是seo正确吗
  • 如何建立一个企业的网站网站平台都有哪些
  • 企业手机网站建设流程网店
  • 研发项目备案在哪个网站做北京seo外包公司要靠谱的
  • 国外有什么网站做游戏吗河南公司网站建设
  • 什么是网站的后台太原搜索引擎优化
  • 合肥营销型网站建设百度搜索资源平台官网
  • 深圳大型网站建设淘宝热搜关键词排行榜
  • 乐清做网站公司seo行业
  • 门户网站建设推荐推广手段
  • 飞猪旅游的网站建设百度联盟广告点击一次收益
  • 网站月流量18种最有效推广的方式
  • 免费html网站模板下载百度第三季度财报2022
  • 有关做有机肥的企业网站优化分析
  • 龙岩网约车考试哪里报名指定关键词seo报价
  • asp.net jsp 网站网络营销的含义特点
  • 只做一种产品的网站怎么联系百度推广
  • wordpress 函数手册长沙seo就选智优营家
  • 电商网站开发步骤2021最火营销方案
  • 做网站沈阳个人网站制作多少钱
  • 个人性质的网站备案容易查宁波网站推广平台效果好
  • 网络运营学校上海seo公司哪个靠谱
  • 购买网站做网页游戏手机百度网盘网页版登录入口
  • 网站错误404专业地推团队
  • 西安哪家公司做网站pc优化工具
  • 品牌做网站宁波关键词网站排名
  • 提供深圳网站制作公司论坛推广工具
  • 沈阳网站制作培训深圳英文站seo