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 / February 2006

Tip: Looking for answers? Try searching our database.

Paremeter type information from vsCMElementParameter?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alex.mcmorris@gmail.com - 27 Jan 2006 01:15 GMT
Hello,

I'm walking the CodeElements collection in a solutions DTE.Projects
collection and I'm trying to find more information about method
parameters... namely I need to know what type it is but the CodeElement
object doesn't have much in there.  For example, take the following
method:

void MyMethod(MyClass & aClass);

Somewhere deep in the tree would be an element where .Kind equals
vsCMElementFunction and it would have one child whose .Kind is
vsCMElementParameter named "aClass" but no where, can I find that it is
of type MyClass.

Does anyone know how to get that information?  Thanks!
Alex
Carlos J. Quintero [VB MVP] - 27 Jan 2006 09:19 GMT
Once you have a CodeElement of vsCMElementParameter kind, cast it to
EnvDTE.CodeParameter and check its CodeParameter.Type property, which
returns an EnvDTE.CodeTypeRef and check its properties.

Signature

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

> Hello,
>
[quoted text clipped - 13 lines]
> Does anyone know how to get that information?  Thanks!
> Alex
alex.mcmorris@gmail.com - 27 Jan 2006 18:03 GMT
Ok, so the CodeParameter.Type gives me the string of the type in
question but is there any way I can get back to the actual CodeElement
that represents the definition of that type?

Thanks,
Alex
Carlos J. Quintero [VB MVP] - 01 Feb 2006 09:20 GMT
That's a tough question, because the actual type can be:

- A type declared somewhere in your project. In this case you must use
Project.CodeModel.CodeElements, etc. to locate it.
- A type declared somewhere in a referenced project. In this case you must
use CType(Project.Object, VSProject).References, get the
Reference.SourceProject property and use again
Project.CodeModel.CodeElements-
- A type declared somewhere in a referenced assembly. In this case you must
use Reflection to find it, the GetExportedTypes function.

Signature

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

> Ok, so the CodeParameter.Type gives me the string of the type in
> question but is there any way I can get back to the actual CodeElement
> that represents the definition of that type?
>
> Thanks,
> Alex
alex.mcmorris@gmail.com - 06 Feb 2006 08:12 GMT
That's awesome.  That's exactly what I need.  Although, is a string
name match the strongest relationship one can glean?  I guess since
they are identifiers and as long as namespaces are processed properly
it had better be unique.

Thanks!
Alex

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.