private void checkForDuplicateLayerName(ILayer layer) { Predicate <ILayer> namesMatch = delegate(ILayer match) { return(String.Compare(match.LayerName, layer.LayerName, StringComparison.CurrentCultureIgnoreCase) == 0); }; if (_layers.Exists(namesMatch)) { throw new DuplicateLayerException(layer.LayerName); } }