How to get all methods from WCF service?

岁酱吖の 提交于 2019-12-23 04:36:34

问题


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

I already have added service reference to Silverlight application.

Can I get all methods using Reflection?

If can please provide me example.


回答1:


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;
}


来源:https://stackoverflow.com/questions/2720617/how-to-get-all-methods-from-wcf-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!