C# 自动Web表单生成
我有一组C函数,它们带有字符串、int和bool参数,用作数据输入接口。我希望能够为每个方法创建一个webform;每个字符串/int的文本框和每个bool的复选框C# 自动Web表单生成,c#,asp.net,C#,Asp.net,我有一组C函数,它们带有字符串、int和bool参数,用作数据输入接口。我希望能够为每个方法创建一个webform;每个字符串/int的文本框和每个bool的复选框 有没有办法使这个过程自动化?您需要使用反射来检索方法的签名,然后根据其参数创建一个web表单 // Create a container (panel for instance) var parameters = methodInfo.GetParameters(); foreach (var parameter in param
有没有办法使这个过程自动化?您需要使用反射来检索方法的签名,然后根据其参数创建一个web表单
// Create a container (panel for instance)
var parameters = methodInfo.GetParameters();
foreach (var parameter in parameters)
{
if (parameter.ParameterType == typeof(string))
{//Create a text box and add it to the panel}
else if (parameter.ParameterType == typeof(int))
{//Create a numeric box and add it to the panel}
...
}