public static void Generate(StringBuilder buffer, ClrInterface clrInterface) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } if (clrInterface == null) { throw new ArgumentNullException(nameof(clrInterface)); } buffer.Append(GetAccessLevel(clrInterface.AccessLevel)); buffer.Append(' '); buffer.Append(@"interface"); buffer.Append(' '); buffer.AppendLine(clrInterface.Name); buffer.AppendLine(@"{"); foreach (var method in clrInterface.Methods) { buffer.Append('\t'); buffer.Append(GetReturnType(method)); buffer.Append(' '); buffer.Append(method.Name); buffer.Append('('); buffer.Append(GetParameters(method)); buffer.Append(')'); buffer.Append(';'); buffer.AppendLine(); } buffer.Append(@"}"); }
public static string Generate(ClrInterface clrInterface) { if (clrInterface == null) { throw new ArgumentNullException(nameof(clrInterface)); } var buffer = new StringBuilder(); Generate(buffer, clrInterface); return(buffer.ToString()); }