How to use reflection to call method by name

后端 未结 4 1409
太阳男子
太阳男子 2020-11-28 13:46

Hi I am trying to use C# reflection to call a method that is passed a parameter and in return passes back a result. How can I do that? I\'ve tried a couple of things but wit

4条回答
  •  猫巷女王i
    2020-11-28 13:55

    If you're on .NET 4, use dynamic:

    dynamic dService = service;
    var response = dService.CreateAmbience(request);
    

提交回复
热议问题