获取具有给定解决方案文件夹路径的给定.cs的所有方法名称 [英] get all the methods names of a given .cs with given solution folder path

查看:64
本文介绍了获取具有给定解决方案文件夹路径的给定.cs的所有方法名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个要求,我需要从给定文件路径(这是其他应用程序中.cs文件的路径)的.cs文件中获取所有方法名称.

Hi,

I have a requirement where i need to fetch all the method names from the .cs file of a given file path(it is the path of the .cs file in other application).

推荐答案

1)读取文件.
2)使用正则表达式确定方法签名.如果匹配,请获取方法名称.
1) Read the file.
2) Use regular expression to determine the method signature. If it matches, get the method name.


如果可以访问该类,则可以通过反射来实现,

If you have access to the class you can do it by reflection,

typeOf(MyClass).GetMethods()



此代码未经测试,并且不完全相同.您可以使用intellisense找到类似的方法.



This code is not tested and not exactly same. You can find a similar method with intellisense.



您可以为此使用dotnet 反射 概念,这是逐步的
Hi
You can use dotnet Reflection Concept for this, here is the step by step HELP


这篇关于获取具有给定解决方案文件夹路径的给定.cs的所有方法名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆