How to get the list of methods called from a method using reflection in C# (DotNet) or How can I check whether Method1 is called from Method2 using reflection?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
As others have pointed out, this is essentially impossible to do using reflection. You'd have to parse the IL byte code of the methods yourself in order to find the calls. Luckily, there's a beautiful project going by the name of Mono Cecil (also available on nuget) that does all the hard work for you. Here's a minimal example to illustrate how your problem could be solved using Mono Cecil: