如何从WCF服务的方法?方法、WCF

2023-09-04 23:35:43 作者:拿稳自己再说话

如何获得来自WCF Silverlight的支持服务的所有方法从code列表中。

How to get list of all methods from WCF silverlight enabled service from code.

我已经添加服务引用Silverlight应用程序。

I already have added service reference to Silverlight application.

我可以得到所有的方法使用反射?

Can I get all methods using Reflection?

如果可以请给我提供的例子。

If can please provide me example.

推荐答案

由于服务类的,你可以使用的 的getMethods功能打通反射所有方法的列表:

Given the type of the service class you could use the GetMethods function to get a list of all the methods through reflection:

MethodInfo[] methods = typeof(TypeOfTheService).GetMethods();
foreach (var method in methods)
{
    string methodName = method.Name;
}