Find Methods in a c# File programmatically

Posted by sajad on Stack Overflow See other posts from Stack Overflow or by sajad
Published on 2010-05-26T13:04:41Z Indexed on 2010/05/26 14:01 UTC
Read the original article Hit count: 245

Filed under:
|
|

Hi Friends,

I want to write a code to search for method defination and methods called in a c# file.

So obviously my pattern should search for text like

1.public void xyz(blahtype blahvalue);

2.string construct = SearchData(blahvalue);

Has anyone done similar to this, is Regex helpful in this case. if yes provide me the pattern. Any other workarounds. I dont know reflection(will it help in my case)


Thanks, you guys gave it a try, i did not know this wud be so complex. All i wanted to do was suppose i have method like this

public method1(int val)

{

method2();

method3();

}

void method2(int val2)

{

method4()

}

i wanted to construct a string as Method1:Method2:method4 and Method1:Method3....

I guess its really complex

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex