public virtual bool Contains(IFeature feature) { if (Features.Count == 0) { return(false); } // Since Features can be strongly collection typed we must prevent searching objects of an invalid type if (FeatureType != null) { // test if feature we are looking for is derived from FeatureType if (!FeatureType.IsAssignableFrom(feature.GetType())) { return(false); } } else { // if FeatureType is not set use type of first object in collection. if (Features[0].GetType() != feature.GetType()) { return(false); } } return(Features.Contains(feature)); }