[blam] An easier way to check for duplicate channel entries
- From: Carlos MartÃn Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam] An easier way to check for duplicate channel entries
- Date: Sat, 4 Aug 2012 19:06:21 +0000 (UTC)
commit ce0f357fce5f48f175e56297649cc201769261c8
Author: Carlos MartÃn Nieto <carlos cmartin tk>
Date: Sat Aug 4 21:05:00 2012 +0200
An easier way to check for duplicate channel entries
src/ChannelCollection.cs | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/src/ChannelCollection.cs b/src/ChannelCollection.cs
index 7f7a427..9a23c02 100644
--- a/src/ChannelCollection.cs
+++ b/src/ChannelCollection.cs
@@ -173,12 +173,9 @@ namespace Imendio.Blam {
public void Add (IChannel channel)
{
- // Not the most efficient way of doing things :)
- foreach (Channel ch in mChannels) {
- if (channel.Url == ch.Url) {
- return;
- }
- }
+ // If we already have this feed, simply return
+ if (mChannels.Cast<Channel>().Any(channel.Url.Equals))
+ return;
if(channel.Name == null){
channel.Name = channel.Url;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]