不看你后悔~~~~~~

Cbirdfly 2010-08-10 08:59:02
在抓去网页后 的到所有链接 怎样去掉重复链接~~~~~?
高手帮帮忙吧
最好给出代码,说出思路~~~~~~
不在数据库中判断,在程序中~~~~~~
OK? 谢谢啦~~~~
由于本人没多少分了,大家见谅啦~~~~~~~~~高手应该不在乎得分吧~~~~~
...全文
216 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
东邪独孤 2010-08-10
  • 打赏
  • 举报
回复
文件夹里的重复文件名你会找吧?道理其实也一样。我不写代码了,机子上没安装VS。
youkebing 2010-08-10
  • 打赏
  • 举报
回复
看了也後悔
leyt 2010-08-10
  • 打赏
  • 举报
回复
后悔的看了
偷懒的牛 2010-08-10
  • 打赏
  • 举报
回复
路过,可以拿分不??
wilensky 2010-08-10
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 xzjxylophone 的回复:]

引用 17 楼 liuh6 的回复:

引用 15 楼 cloudhsu 的回复:
看了很后悔....

越看越后悔!~


后悔的看了
[/Quote]

后悔的看了
xzjxylophone 2010-08-10
  • 打赏
  • 举报
回复
[Quote=引用 17 楼 liuh6 的回复:]

引用 15 楼 cloudhsu 的回复:
看了很后悔....

越看越后悔!~
[/Quote]

后悔的看了
liuh6 2010-08-10
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 cloudhsu 的回复:]
看了很后悔....
[/Quote]
越看越后悔!~
麦麦_同学 2010-08-10
  • 打赏
  • 举报
回复
.trme()
云瑀 2010-08-10
  • 打赏
  • 举报
回复
看了很后悔....
bobo_包子 2010-08-10
  • 打赏
  • 举报
回复
1.排序
2.判断元素前后是否相等
bobo_包子 2010-08-10
  • 打赏
  • 举报
回复
            List<string> _s = new List<string>();
_s.Add("a");
_s.Add("b");
_s.Add("v");
_s.Add("a");
_s.Add("b");
_s.Add("a");
List<string> _ns = new List<string>();
_s.Sort();
int _l = _s.Count;
for (int i = 0; i < _l - 1; i++)
{
if (!_s[i].Equals(_s[i + 1]))
{
_ns.Add(_s[i]);
}
}
if (!_s[_l - 2].Equals(_s[_l - 1]))
_ns.Add(_s[_l - 1]);
Console.Read();
bobo_包子 2010-08-10
  • 打赏
  • 举报
回复
该升级你的VS了,别搞的太落后
Cbirdfly 2010-08-10
  • 打赏
  • 举报
回复
为啥 我的VS2005中List<string> _s=new List<string>();
没有_s.Distinct()方法?
一克代码 2010-08-10
  • 打赏
  • 举报
回复
List<string> _s = new List<string>();
IList<string> _news = _s.Distinct().ToList();

将获取的连接add到List<string>
jingkunliu 2010-08-10
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 qdwangle 的回复:]
看了更后悔...
[/Quote]
同感同感
hytwl 2010-08-10
  • 打赏
  • 举报
回复
4#的方法是可行的
醒子宇 2010-08-10
  • 打赏
  • 举报
回复
好后悔···
村长_乐 2010-08-10
  • 打赏
  • 举报
回复
看了更后悔...
jrl5365 2010-08-10
  • 打赏
  • 举报
回复
1 #region 过滤重复数据
2 public delegate bool EqualsComparer<T>(T x, T y);
3 /// <summary>
4 /// 过滤重复数据
5 /// </summary>
6 public class Comparint<T> : IEqualityComparer<T>
7 {
8 private EqualsComparer<T> ec;
9 public Comparint() { }
10 public Comparint(EqualsComparer<T> e)
11 {
12 this.ec = e;
13 }
14 #region IEqualityComparer<BudgetBE> 成员
15
16 public bool Equals(T x, T y)
17 {
18 if (null != this.ec)
19 return this.ec(x, y);
20 else
21 return false;
22 }
23
24 public int GetHashCode(T obj)
25 {
26 return obj.ToString().GetHashCode();
27 }
28
29 #endregion
30 }
31 #endregion



使用时:



1 list.Distinct(new Comparint<自定义类型>(
2 delegate (自定义类型 x, 自定义类型 y)
3 {
4 if (null != x && null != y)
5 return x.属性 == y.属性;
6 return false;
7 }
8 ));
jrl5365 2010-08-10
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 bbs2241 的回复:]
C# code
List<string> _s = new List<string>();
IList<string> _news = _s.Distinct().ToList();

将获取的连接add到List<string>
[/Quote]

+1
加载更多回复(3)

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧