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);
 }
 protected virtual void Write(IndentedTextWriter writer, CodeObjectCollection <CustomAttribute> attributes)
 {
     if (attributes.Count > 0)
     {
         Write(writer, attributes, writer.NewLine);
         writer.WriteLine();
     }
 }
 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);
 }
 protected virtual void Write(IndentedTextWriter writer, CodeObjectCollection <MethodArgumentDeclaration> args)
 {
     Write(writer, args, ", ");
 }