System.ComponentModel.TypeDescriptor.GetExtenderCollisionSuffix C# (CSharp) Method

GetExtenderCollisionSuffix() private static method

This method is invoked during filtering when a name collision is encountered between two properties or events. This returns a suffix that can be appended to the name to make it unique. This will first attempt ot use the name of the extender. Failing that it will fall back to a static index that is continually incremented.
private static GetExtenderCollisionSuffix ( MemberDescriptor member ) : string
member MemberDescriptor
return string
        private static string GetExtenderCollisionSuffix(MemberDescriptor member)
        {
            string suffix = null;

            ExtenderProvidedPropertyAttribute exAttr = member.Attributes[typeof(ExtenderProvidedPropertyAttribute)] as ExtenderProvidedPropertyAttribute;
            if (exAttr != null)
            {
                IExtenderProvider prov = exAttr.Provider;

                if (prov != null)
                {
                    string name = null;
                    IComponent component = prov as IComponent;

                    if (component != null && component.Site != null)
                    {
                        name = component.Site.Name;
                    }

                    if (name == null || name.Length == 0)
                    {
                        int ci = System.Threading.Interlocked.Increment(ref s_collisionIndex) - 1;
                        name = ci.ToString(CultureInfo.InvariantCulture);
                    }

                    suffix = string.Format(CultureInfo.InvariantCulture, "_{0}", name);
                }
            }

            return suffix;
        }