private bool Contains(IAccessRule rule) { return(_accessRules.SingleOrDefault(x => x.GetType() == rule.GetType()) != null); }
public void AppendAccessRule(IAccessRule rule) { Guard.AgainstArgumentNull(rule, "rule"); if (!Contains(rule)) { _accessRules.Add(rule); } else { throw new ArgumentException(string.Format("Rule '{0}' is already added", rule.GetType())); } }