从.CS文件获取MethodNames和MethodBody [英] Get MethodNames and MethodBody from .CS file

查看:124
本文介绍了从.CS文件获取MethodNames和MethodBody的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...

我有一个要求,要从使用OpenDialogue Control上传的.CS文件中收集所有方法名称,当我从检索到的方法列表中选择任何方法名称时,我需要显示方法主体或方法内容...

我已经使用了反射,但是我知道它仅适用于编译的,而不适用于.cs,

PL帮助我解决问题...

Hi EveryOne...

I have an Requirement to collect all the method names from .CS file which is uploaded using OpenDialogue Control,and when i select any method names from list of methods that retrieved i need to show the method body or method content...

i have used reflection but i came to know that its only for compiled ones and not for .cs,

PLs help me out...

推荐答案

将其读取为纯文本文件:您知道方法从何处开始,因此可以算出方法在何处结束(或者,也许,下一个方法开始的地方),然后显示介于两者之间的所有内容.
Read it as a plain text file: you know where a method starts so you can work out where it ends (or, perhaps, where the next method begins) and then display everything in between.


这篇关于从.CS文件获取MethodNames和MethodBody的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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