public static string MethodHeader(int depth, AccessModifier scope, MethodModifier modifier, Type returnType, string name) { var header = string.Empty; string _modifier = modifier.ToString(); string _scope = scope.ToString(); string _returnType = returnType.Name.ToString(); _scope = _scope.AddLowerUpperNeighboringSpaces(); _scope = _scope.ToLower(); _modifier = _modifier.ToLower(); if (modifier == MethodModifier.None) { _modifier = string.Empty; } if (returnType.DeclaringType != returnType || returnType.DeclaringType != typeof(object)) { if (ToLowerReturnTypes.Contains(returnType)) { _returnType = _returnType.ToLower(); } } header += Indent(depth) + _scope + " " + _modifier + " " + _returnType + " " + name + "(" + ")"; return(header); }
public static string MethodHeader(int depth, AccessModifier scope, MethodModifier modifier, Type returnType, string name, Dictionary <string, Type> parameters) { var header = string.Empty; var keys = parameters.Keys.ToListPooled(); var values = parameters.Values.ToListPooled(); var _parameters = string.Empty; for (int i = 0; i < parameters.Count; i++) { _parameters += ((i > 0) ?" " : string.Empty); _parameters += values[i].CSharpName() + " "; _parameters += Patcher.LegalVariableName(keys[i], false) + ((i != parameters.Count - 1) ? "," : string.Empty); } header += "\n"; header += CodeBuilder.Indent(depth) + Patcher.AddLowerUpperNeighboringSpaces(scope.ToString()).ToLower() + " " + ((modifier == MethodModifier.None) ? string.Empty : modifier.ToString().ToLower()) + ((modifier == MethodModifier.None) ? string.Empty : " ") + (returnType == null || returnType == typeof(Void) ? typeof(void).CSharpName() : Ludiq.CSharpNameUtility.CSharpName(returnType)) + " " + name + "(" + _parameters + ")"; return(header); }