protected virtual void ValidateName(IComponent component, string name)
{
if (component == null)
{
throw new ArgumentNullException(nameof(component));
}
if (name != null)
{
for (int i = 0; i < Math.Min(_siteCount, _sites.Length); i++)
{
ISite s = _sites[i];
if (s != null && s.Name != null
&& string.Equals(s.Name, name, StringComparison.OrdinalIgnoreCase)
&& s.Component != component)
{
InheritanceAttribute inheritanceAttribute = (InheritanceAttribute)TypeDescriptor.GetAttributes(s.Component)[typeof(InheritanceAttribute)];
if (inheritanceAttribute.InheritanceLevel != InheritanceLevel.InheritedReadOnly)
{
throw new ArgumentException(SR.Format(SR.DuplicateComponentName, name));
}
}
}
}
}