private static void WriteParametersToTranslation(MethodBase method, TranslationBuffer buffer) { var parameters = method.GetParameters(); if (!parameters.Any()) { buffer.WriteToTranslation("()"); return; } buffer.WriteNewLineToTranslation(); buffer.WriteToTranslation('('); buffer.Indent(); for (var i = 0; ;) { var parameter = parameters[i]; var parameterType = parameter.ParameterType; buffer.WriteNewLineToTranslation(); if (parameter.IsOut) { buffer.WriteToTranslation("out "); parameterType = parameterType.GetElementType(); } else if (parameterType.IsByRef) { buffer.WriteToTranslation("ref "); parameterType = parameterType.GetElementType(); } buffer.WriteFriendlyName(parameterType); buffer.WriteSpaceToTranslation(); buffer.WriteToTranslation(parameter.Name); if (++i == parameters.Length) { break; } buffer.WriteToTranslation(','); } buffer.Unindent(); buffer.WriteNewLineToTranslation(); buffer.WriteToTranslation(')'); }