コード例 #1
0
 protected ClassOrStructDeclaration()
 {
     Implements = new List <TypeReference>();
     Parameters = new CodeObjectCollection <TypeParameter>(this);
     Members    = new CodeObjectCollection <MemberDeclaration>(this);
     Types      = new CodeObjectCollection <TypeDeclaration>(this);
 }
コード例 #2
0
 public StructDeclaration(string?name)
 {
     Name       = name;
     Implements = new List <TypeReference>();
     Parameters = new CodeObjectCollection <TypeParameter>(this);
     Members    = new CodeObjectCollection <MemberDeclaration>(this);
     Types      = new CodeObjectCollection <TypeDeclaration>(this);
 }
コード例 #3
0
 protected virtual void Write(IndentedTextWriter writer, CodeObjectCollection <CustomAttribute> attributes)
 {
     if (attributes.Count > 0)
     {
         Write(writer, attributes, writer.NewLine);
         writer.WriteLine();
     }
 }
コード例 #4
0
 private void WriteGenericParameters(IndentedTextWriter writer, CodeObjectCollection <TypeReference> types)
 {
     if (types.Any())
     {
         writer.Write("<");
         Write(writer, types, ", ");
         writer.Write(">");
     }
 }
コード例 #5
0
        private void VisitCollection <T>(CodeObjectCollection <T> items) where T : CodeObject
        {
            if (items == null)
            {
                return;
            }

            foreach (var item in items)
            {
                Visit(item);
            }
        }
コード例 #6
0
 public MethodInvokeExpression(Expression?method, TypeReference[]?parameters, params Expression[] arguments)
 {
     Parameters = new List <TypeReference>();
     Arguments  = new CodeObjectCollection <Expression>(this);
     Method     = method;
     Arguments.AddRange(arguments);
     if (parameters != null)
     {
         foreach (var parameter in parameters)
         {
             Parameters.Add(parameter);
         }
     }
 }
コード例 #7
0
        protected ConstructorInitializer(IEnumerable <Expression>?codeExpressions)
        {
            CommentsBefore = new CommentCollection(this);
            CommentsAfter  = new CommentCollection(this);
            Arguments      = new CodeObjectCollection <Expression>(this);

            if (codeExpressions != null)
            {
                foreach (var codeExpression in codeExpressions)
                {
                    Arguments.Add(codeExpression);
                }
            }
        }
コード例 #8
0
 public virtual void VisitExpressions(CodeObjectCollection <Expression> expressions)
 {
     VisitCollection(expressions);
 }
コード例 #9
0
 protected virtual void Write(IndentedTextWriter writer, CodeObjectCollection <MethodArgumentDeclaration> args)
 {
     Write(writer, args, ", ");
 }