Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Roslyn 中,控制流图具有构成程序的BasicBlock列表。是否可以从每个块中获取代码语句来重构整个代码?
据我所知,使用 Roslyn 的内置方法是不可能的。我通过使用字符串匹配构造块字典和与这些块相对应的行号集来实现类似的结果。对包含锁等的块进行额外过滤以提高准确性。结果不是 100% 准确,但在大多数情况下非常接近。