C#MethodInfo getReturnType

sna*_*ile 3 .net c# reflection void methodinfo

我创建了一个MethodInfo的实例:

MethodInfo theMethod = typeof(Reciever).GetMethod("methodName", parameterTypes);
Run Code Online (Sandbox Code Playgroud)

现在我想知道theMethod的返回类型是否为void.怎么样?

Meh*_*ari 11

简单:

theMethod.ReturnType == typeof(void)
Run Code Online (Sandbox Code Playgroud)