明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: 遇见123go

[基础] Point3dCollection

[复制链接]
 楼主| 发表于 2015-5-19 15:51 | 显示全部楼层
雪山飞狐_lzh 发表于 2015-5-19 14:53
.net3.5 引用linq

学习了,谢谢
 楼主| 发表于 2015-5-19 16:02 | 显示全部楼层
遇见123go 发表于 2015-5-19 15:51
学习了,谢谢

版主,程序是弄出来了,但是估计您没有理解到我的意思,我想要达到的目的是,假如pts中保存有(1,1,0)、(1,1,0)、(2,1,0)、(2,1,0)、(2,1,0)、(2,2,0)这些点,只要有相等的点都不输出,这里就只要输出(2,2,0)这个点,请问版主有没有些思路,麻烦您了
发表于 2015-5-19 21:36 | 显示全部楼层
Linq最好去网上百度下 这个学了很有用的

  1.             Point3dCollection pts = new Point3dCollection { new Point3d(), new Point3d(), new Point3d(1, 1, 0) };
  2.             var lst =
  3.                 pts.Cast<Point3d>()
  4.                 .GroupBy(p => p)
  5.                 .Where(g => g.Count() == 1)
  6.                 .Select(g => g.Key);

  7.             var doc = Application.DocumentManager.MdiActiveDocument;
  8.             var ed = doc.Editor;

  9.             foreach (var pt in lst)
  10.                 ed.WriteMessage("\nPoint:{0}", pt);
 楼主| 发表于 2015-5-20 08:30 | 显示全部楼层
雪山飞狐_lzh 发表于 2015-5-19 21:36
Linq最好去网上百度下 这个学了很有用的

问题解决了,谢谢飞狐版主,Linq我会去学习的,谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-5 18:06 , Processed in 0.257565 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表