Exemple #1
0
 private void DefineCustomAttributes(ICustomAttributeTargetBuilder customAttributeTargetBuilder, IMutableInfo mutableInfo)
 {
     foreach (var declaration in mutableInfo.AddedCustomAttributes)
     {
         customAttributeTargetBuilder.SetCustomAttribute(declaration);
     }
 }
        public void SetCustomAttribute(CustomAttributeDeclaration customAttributeDeclaration)
        {
            ArgumentUtility.CheckNotNull("customAttributeDeclaration", customAttributeDeclaration);

            var emittableConstructorArguments = customAttributeDeclaration.ConstructorArguments.Select(MakeAttributeArgumentEmittable).ToArray();
            var emittableNamedArguments       = customAttributeDeclaration.NamedArguments.Select(MakeEmittable).ToArray();
            var emittableDeclaration          = new CustomAttributeDeclaration(
                customAttributeDeclaration.Constructor, emittableConstructorArguments, emittableNamedArguments);

            _customAttributeTargetBuilder.SetCustomAttribute(emittableDeclaration);
        }