Suggestions for making a reusable try/catch block in C#?

后端 未结 5 1743
故里飘歌
故里飘歌 2021-01-30 09:33

I have a class that has about 20-some methods in it. Each one does some web service message processing. I just had to make a change to it, and realized that every one of these m

5条回答
  •  野性不改
    2021-01-30 10:08

    If the parameters are same or close to the same you can always pass in a delegate. If they are not your could call the code by reflection and take a parameter of 'object[]' to pass to invoke.

提交回复
热议问题