Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ValidateName()

virtual void System.ComponentModel.Container.ValidateName ( IComponent component,
string? name )
inlineprotectedvirtualinherited

Definition at line 224 of file Container.cs.

225 {
226 if (component == null)
227 {
228 throw new ArgumentNullException("component");
229 }
230 if (name == null)
231 {
232 return;
233 }
234 for (int i = 0; i < Math.Min(_siteCount, _sites.Length); i++)
235 {
236 ISite site = _sites[i];
237 if (site != null && site.Name != null && string.Equals(site.Name, name, StringComparison.OrdinalIgnoreCase) && site.Component != component)
238 {
239 InheritanceAttribute inheritanceAttribute = (InheritanceAttribute)TypeDescriptor.GetAttributes(site.Component)[typeof(InheritanceAttribute)];
240 if (inheritanceAttribute.InheritanceLevel != InheritanceLevel.InheritedReadOnly)
241 {
243 }
244 }
245 }
246 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string DuplicateComponentName
Definition SR.cs:88
Definition SR.cs:7

References System.ComponentModel.Container._siteCount, System.ComponentModel.Container._sites, System.ComponentModel.ISite.Component, System.SR.DuplicateComponentName, System.SR.Format(), System.ComponentModel.TypeDescriptor.GetAttributes(), System.ComponentModel.InheritanceAttribute.InheritanceLevel, System.Math.Min(), and System.ComponentModel.ISite.Name.

Referenced by System.ComponentModel.Container.Add().