/// <summary> /// Writes this MethodDefinition into the provided StringBuilder. /// </summary> /// <param name="b">The target.</param> /// <returns>The StringBuilder to enable fluent syntax.</returns> public StringBuilder Write(StringBuilder b) { if (b == null) { throw new ArgumentNullException(nameof(b)); } if (Attributes.HasAttributes) { Attributes.Write(b); b.AppendLine(); } Modifiers.Write(b); if (ReturnType != null) { ReturnType.Write(b); b.Append(' '); } MethodName.Write(b); WriteParameters(b, true, true, true); if (Constraints.Count > 0) { b.Append(' '); bool already = false; foreach (var c in Constraints) { if (already) { b.Append(' '); } else { already = true; } c.Write(b); } } if (ThisOrBaseConstructorCall != CallConstructor.None) { b.Append(" : ") .Append(ThisOrBaseConstructorCall == CallConstructor.This ? "this" : "base") .Append('(') .Append(ThisOrBaseConstructorParameters) .Append(')'); } return(b); }