Is there any way to get a reference to the calling object in c#?

前端 未结 3 1963
遥遥无期
遥遥无期 2020-12-03 09:59

What I\'m wondering is if it\'s possible to (for instance) to walk up the stack frames, checking each calling object to see if matches an interface, and if so extract some d

3条回答
  •  Happy的楠姐
    2020-12-03 10:41

    See this question:
    Can you use reflection to find the name of the currently executing method?

    It's not a duplicate, but the answer to that question will answer yours as well.

提交回复
热议问题