コード例 #1
0
        internal override IEnumerable <AttributeData> GetCustomAttributesToEmit(CommonModuleCompilationState compilationState)
        {
            // [param]
            if (IsParams)
            {
                yield return(DeclaringCompilation.CreateParamsAttribute());
            }

            // [NotNull]
            if (IsNotNull && Type.IsReferenceType)
            {
                yield return(DeclaringCompilation.CreateNotNullAttribute());
            }

            // [DefaultValue]
            if (this.Initializer is BoundArrayEx arr)
            {
                yield return(DeclaringCompilation.CreateDefaultValueAttribute(Routine, arr));
            }

            //
            yield break;
        }
コード例 #2
0
        internal override IEnumerable <AttributeData> GetCustomAttributesToEmit(CommonModuleCompilationState compilationState)
        {
            // [param]
            if (IsParams)
            {
                yield return(DeclaringCompilation.CreateParamsAttribute());
            }

            // [NotNull]
            if (IsNotNull && Type.IsReferenceType)
            {
                yield return(DeclaringCompilation.CreateNotNullAttribute());
            }

            // [DefaultValue]
            if (DefaultValueField != null)
            {
                yield return(DeclaringCompilation.CreateDefaultValueAttribute(ContainingType, DefaultValueField));
            }

            //
            yield break;
        }