Get types used inside a C# method body

后端 未结 7 868
鱼传尺愫
鱼传尺愫 2020-12-01 16:12

Is there a way to get all types used inside C# method?

For example,

public int foo(string str)
{
    Bar bar = new Bar();
    string x = \"test\";
           


        
7条回答
  •  一向
    一向 (楼主)
    2020-12-01 17:13

    If you can access the IL for this method, you might be able to do something suitable. Perhaps look at the open source project ILSpy and see whether you can leverage any of their work.

提交回复
热议问题