/// <summary> /// Adds the method header to the class writer. /// </summary> /// <param name="cw">The class writer.</param> public void ToString(ClassWriter cw) { string newString = this.New ? "new " : string.Empty; string overrideString = this.Override ? "override " : string.Empty; string paramList = string.Join(", ", this.Parameters.Select(p => { string def = string.Empty; if (p.DefaultValue != null) { def = $" = {p.DefaultValue}"; } return($"{p.Type} {p.Name}{def}"); })); if (this.Override) { cw.AppendLine("/// <inheritdoc/>"); } else { if (!string.IsNullOrWhiteSpace(this.SummaryDoc) && this.SummaryDoc != null) { cw.SummaryDoc(this.SummaryDoc); } foreach (var param in this.Parameters) { cw.AppendLine($@"/// <param name=""{param.Name}"">{param.Description}</param>"); } if (!string.IsNullOrWhiteSpace(this.ReturnsDoc)) { cw.AppendLine($"/// <returns>{this.ReturnsDoc}</returns>"); } } cw.AppendLine($"{this.Access.AccessString()} {newString}{overrideString}{this.Type} {this.Name}({paramList})"); }
/// <summary> /// Initializes a new instance of the <see cref="Braces"/> class. /// </summary> /// <param name="writer">The class writer to manage.</param> public Braces(ClassWriter writer) { this.writer = writer; this.writer.StartBrace(); }