Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / December 2007

Tip: Looking for answers? Try searching our database.

Retrieve a list of types used inside a function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ofer David - 22 Dec 2007 19:18 GMT
Hi.

I have a CodeFunction instance. i need to inspect the function and
retrieve the list of all types used inside the function code.

for example

class x
{
    public void foo()
    {
         string some_str;
         double some_number;
    }
};

the types used inside the function are, of-course: string and double.
how can I get that information programmatically using the CodeFunction
instance?

Thank you very much.

David
Peter Macej - 23 Dec 2007 10:47 GMT
The code model doesn't provide that information. You need to manually
parse the function source code.

Signature

Peter Macej
Helixoft - http://www.helixoft.com
VSdocman - Commenter and generator of class documentation for C#, VB
.NET and ASP .NET code

doublemaster007@gmail.com - 24 Dec 2007 08:16 GMT
> The code model doesn't provide that information. You need to manually
> parse the function source code.
[quoted text clipped - 4 lines]
> VSdocman - Commenter and generator of class documentation for C#, VB
> .NET and ASP .NET code

Is it possible to retrieve the function body some how? For example,
say i have a CodeFunction or CodeElement instance. Is there any way
that i can get its definition, So that i can parse later on?
Peter Macej - 24 Dec 2007 14:07 GMT
Yes. Use CodeFunction.StartPoint and CodeFunction.EndPoint to get text
region. Get EditPoint from TextPoint and use its GetText method.
Something like this:
source =
CodeFunction.StartPoint.CreateEditPoint().GetText(CodeFunction.EndPoint)

Signature

Peter Macej
Helixoft - http://www.helixoft.com
VSdocman - Commenter and generator of class documentation for C#, VB
.NET and ASP .NET code


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.