Esempio n. 1
0
        public static CodeBlockBuilder AttributeMethodImpl(this CodeBlockBuilder builder, MethodImplOptions options)
        {
            var flags        = Enum.GetValues(typeof(MethodImplOptions)).Cast <Enum>().Where(options.HasFlag);
            var fullFlagName = flags.Select(x => $"System.Runtime.CompilerServices.MethodImplOptions.{x}");

            return(builder.Attribute($"[System.Runtime.CompilerServices.MethodImpl({string.Join(", ", fullFlagName)})]"));
        }
        private protected void WriteContent(IndentedStringBuilder builder)
        {
            foreach (var layout in _layout)
            {
                if (layout is string str)
                {
                    builder.AppendLine(str);
                }
                if (layout is BlockInfo blockInfo)
                {
                    var nestedBlock = new CodeBlockBuilder();
                    blockInfo.BlockAction(nestedBlock);

                    builder.AppendLine(blockInfo.Name);
                    builder.AppendLine("{");
                    nestedBlock.WriteContent(builder.NextIndentation());
                    builder.AppendLine("}");
                }
            }
        }
Esempio n. 3
0
 public static CodeBlockBuilder AttributeGenerated(this CodeBlockBuilder builder, Assembly assebmly) => builder.Attribute($"[System.CodeDom.Compiler.GeneratedCode(\"{assebmly.GetName().Name}\", \"{assebmly.GetName().Version}\")]");
Esempio n. 4
0
 public static CodeBlockBuilder AttributeHideEditor(this CodeBlockBuilder builder) => builder.Attribute("[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]");