using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.Contracts;
using System.Linq;
namespace PleaseIgnore.IntelMap {
///
/// Specialization of
/// providing a list of .
///
public class IntelChannelCollection : ReadOnlyCollection {
///
/// Initializes a new instance of .
///
///
/// The list to expose to the user.
///
///
/// is not copied by
/// , so
/// a synchronized copy must be made by the container.
///
public IntelChannelCollection(IList list)
: base(list) {
Contract.Requires(list != null, "list");
Contract.Requires(Contract.ForAll(list, x => x != null));
}
///
/// Gets any monitoring the specified
/// channel.
///
///
/// The to fetch.
///
///
/// An instance of with the
/// specified by
/// or if
/// no such channel is being monitored.
///
public IntelChannel this[string name] {
get {
if (name == null) {
return null;
} else {
return this.FirstOrDefault(x => String.Equals(
x.Name,
name,
StringComparison.OrdinalIgnoreCase));
}
}
}
}
}