I am writing a Visual Studio.NET add in. As a start I would like to enumerate
all the classes in the solution that consists of C# projects. So I am
writing:
Solution sln = dte.Solution;
foreach (Project project in sln.Projects)
foreach (CodeElement codeElement in project.CodeModel.CodeElements)
if (codeElement.Kind == vsCMElement.vsCMElementNamespace)
{
//CodeNamespace codeNamespace = (CodeNamespace) codeElement;
foreach (CodeElement codeNamespaceElement in codeElement.Children)
{
if ( codeNamespaceElement.Kind == vsCMElement.vsCMElementClass )
{
CodeClass codeClass = ( CodeClass )codeNamespaceElement;
MessageBox.Show(codeClass.FullName);
}
}
}
However, trying to access codeElement.Children throws a
NonImplementedException. Is there any way out to enumerate all the classes in
the solution?
Thank you!
Yes, for C#, VJ# and VB.NET projects you must use the Members property of
CodeNamespace, CodeClass, etc. instead of the Children property of
CodeElement.

Signature
Carlos J. Quintero
The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com
>I am writing a Visual Studio.NET add in. As a start I would like to
>enumerate
[quoted text clipped - 20 lines]
> the solution?
> Thank you!