コード例 #1
0
        public virtual IList <ILine> ToLines()
        {
            IList <ILine> constructorLines = new List <ILine>();

            constructorLines.Add(new TemplateLine("public " + this._class.Name + "(" + TemplatesHelper.ListOutParameters(this.parameters) + ")"));

            if (this.baseParameters != null)
            {
                constructorLines.Add(new TemplateLine("\t: base(" + TemplatesHelper.ListOutVariables(this.baseParameters) + ")"));
            }
            else if (this.thisParameters != null)
            {
                constructorLines.Add(new TemplateLine("\t: this(" + TemplatesHelper.ListOutVariables(this.thisParameters) + ")"));
            }

            constructorLines.Add(new TemplateLine("{"));

            foreach (ILine line in this.codeBlock.Lines)
            {
                constructorLines.Add(new TemplateLine(this.indent + line.Code));
            }

            constructorLines.Add(new TemplateLine("}"));

            return(constructorLines);
        }
コード例 #2
0
 public static string ListOutParameters(IList <IVariable> parameters)
 {
     return(TemplatesHelper.ListOutParameters(parameters, TemplatesHelper.DefaultSeperator));
 }