![]() |
||||
Introduction Several classes of the extensibility model have a Properties collection such as:
Those collections provide properties that are not part of the class because they can vary from project type or language, etc. Sometimes you are looking for a property but you don't know the name. This article explains how to guess it. More Information The obvious way to guess the names in the properties collection is to iterate them with a procedure or macro like this: Public Sub EnumeratePropeties(ByVal properties As EnvDTE.Properties) Dim objProperty As EnvDTE.Property For Each objProperty In properties Try Debug.WriteLine("Name: " & objProperty.Name)
If objProperty.Value Is Nothing Then
Debug.WriteLine("Value: Nothing")
Else
Debug.WriteLine("Value: " & objProperty.Value.ToString)
End If
Catch objException As Exception
Debug.WriteLine(objException.ToString)
End Try
Debug.WriteLine("--------------------------------------------------")
Next End Sub However, if you are looking for a specific property, several assemblies of the extensibility model (see INFO: Assemblies used in Visual Studio Extensibility) define interfaces whose property members are the names of the properties inside the collection. For project properties:
For project item properties:
For project configuration properties:
Notice that you must still use the Properties.Item("property_name") method to get a property. The interfaces are used internally by Visual Studio but from your point of view they are only used to let you know the property names that you can expect in the Properties collection. Related articles
Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this
|
| Copyright © 2000-2013 MZTools Software. All Rights Reserved. Legal Notice |