public void CopyCustomAttributes()

in ILRepack/RepackImporter.cs [789:811]


        public void CopyCustomAttributes(Collection<CustomAttribute> input, Collection<CustomAttribute> output, bool allowMultiple, IGenericParameterProvider context)
        {
            var reflectionHelper = _repackContext.ReflectionHelper;
            foreach (CustomAttribute ca in input)
            {
                var caType = ca.AttributeType;
                var similarAttributes = output.Where(attr => reflectionHelper.AreSame(attr.AttributeType, caType)).ToList();
                if (similarAttributes.Count != 0)
                {
                    if (!allowMultiple)
                        continue;
                    if (!CustomAttributeTypeAllowsMultiple(caType))
                        continue;
                    if (similarAttributes.Any(x =>
                            reflectionHelper.AreSame(x.ConstructorArguments, ca.ConstructorArguments) &&
                            reflectionHelper.AreSame(x.Fields, ca.Fields) &&
                            reflectionHelper.AreSame(x.Properties, ca.Properties)
                        ))
                        continue;
                }
                output.Add(Copy(ca, context));
            }
        }