public override string GetMethodSignature(MethodInfo info, bool fullForm) { string result = info.Name + "("; string fontBegin = "<font color=\"Blue\">"; string fontEnd = "</font>"; System.Reflection.ParameterInfo[] pars = info.GetParameters(); foreach (System.Reflection.ParameterInfo par in pars) { // special case - skip "thisReport" parameter if (par.Name == "thisReport") { continue; } string modifier = "ByVal"; if (par.IsOptional) { modifier = "Optional " + modifier; } object[] attr = par.GetCustomAttributes(typeof(ParamArrayAttribute), false); if (attr.Length > 0) { modifier += " ParamArray"; } result += fullForm ? fontBegin + modifier + fontEnd + " " + par.Name + " " + fontBegin + "As" + fontEnd + " " : ""; result += (fullForm ? fontBegin : "") + GetEquivalentKeyword(par.ParameterType.Name) + (fullForm ? fontEnd : ""); #if DOTNET_4 if (par.IsOptional && fullForm) { result += CodeUtils.GetOptionalParameter(par, CodeUtils.Language.Vb); } #endif result += ", "; } if (result.EndsWith(", ")) { result = result.Substring(0, result.Length - 2); } result += ")"; if (fullForm) { result += " " + fontBegin + "As " + info.ReturnType.Name + fontEnd; } return(result); }
public override string GetMethodSignatureAndBody(MethodInfo info) { string result = info.Name + "("; result = " private " + GetTypeDeclaration(info.ReturnType) + " " + result; System.Reflection.ParameterInfo[] pars = info.GetParameters(); foreach (System.Reflection.ParameterInfo par in pars) { // special case - skip "thisReport" parameter if (par.Name == "thisReport") { continue; } string paramType = ""; object[] attr = par.GetCustomAttributes(typeof(ParamArrayAttribute), false); if (attr.Length > 0) { paramType = "params "; } paramType += GetTypeDeclaration(par.ParameterType); result += paramType; result += " " + par.Name; #if DOTNET_4 if (par.IsOptional) { result += CodeUtils.GetOptionalParameter(par, CodeUtils.Language.Cs); } #endif result += ", "; } if (result.EndsWith(", ")) { result = result.Substring(0, result.Length - 2); } result += ")"; result += "\r\n"; result += " {\r\n"; result += " return " + info.ReflectedType.Namespace + "." + info.ReflectedType.Name + "." + info.Name + "("; foreach (System.Reflection.ParameterInfo par in pars) { string parName = par.Name; // special case - handle "thisReport" parameter if (parName == "thisReport") { parName = "Report"; } result += parName + ", "; } if (result.EndsWith(", ")) { result = result.Substring(0, result.Length - 2); } result += ");\r\n"; result += " }\r\n"; result += "\r\n"; return(result); }
public override string GetMethodSignatureAndBody(MethodInfo info) { string result = info.Name + "("; result = " Private Function " + result; System.Reflection.ParameterInfo[] pars = info.GetParameters(); foreach (System.Reflection.ParameterInfo par in pars) { // special case - skip "thisReport" parameter if (par.Name == "thisReport") { continue; } string parName = "_" + par.Name; string modifier = "ByVal"; if (par.IsOptional) { modifier = "Optional " + modifier; } object[] attr = par.GetCustomAttributes(typeof(ParamArrayAttribute), false); if (attr.Length > 0) { modifier += " ParamArray"; } result += modifier + " " + parName + " As "; result += GetTypeDeclaration(par.ParameterType); #if DOTNET_4 if (par.IsOptional) { result += CodeUtils.GetOptionalParameter(par, CodeUtils.Language.Vb); } #endif result += ", "; } if (result.EndsWith(", ")) { result = result.Substring(0, result.Length - 2); } result += ")"; result += " As " + GetTypeDeclaration(info.ReturnType); result += "\r\n"; result += " Return Global." + info.ReflectedType.Namespace + "." + info.ReflectedType.Name + "." + info.Name + "("; foreach (System.Reflection.ParameterInfo par in pars) { string parName = "_" + par.Name; // special case - handle "thisReport" parameter if (parName == "_thisReport") { parName = "Report"; } result += parName + ", "; } if (result.EndsWith(", ")) { result = result.Substring(0, result.Length - 2); } result += ")\r\n"; result += " End Function\r\n"; result += "\r\n"; return(result); }