private Type GetInputType()
{
string strText = txtType.Text;
switch (strText)
{
case "Int32": case "int" : case "System.Int32":
return typeof(int);
case "Double": case "double": case "System.Double":
return typeof(double);
case "float": case "Float": case "System.Float":
return typeof(float);
case "Int16": case "System.Int16": case "short":
return typeof(short);
case "Decimal": case "decimal": case "System.Decimal":
return typeof(decimal);
default:
return typeof(int);
}
}
private void btnCapture_Click(object sender, EventArgs e)
{
Type type = GetInputType();
string strTemp = null;
foreach (MethodInfo method in type.GetMethods())
{
strTemp = "方法:" + method.Name + "\n";
rtxtCapture.AppendText(strTemp);
foreach (ParameterInfo parameter in method.GetParameters())
{
strTemp = "参数: " + parameter.Name + "\n";
rtxtCapture.AppendText(strTemp);
}
rtxtCapture.AppendText(Environment.NewLine); //添加换行
}
}