Partager via


Reference.ContainingProject, propriété

Obtient le projet dont fait partie l'élément sélectionné. En lecture seule.

Espace de noms :  VSLangProj
Assembly :  VSLangProj (dans VSLangProj.dll)

Syntaxe

'Déclaration
ReadOnly Property ContainingProject As Project
Project ContainingProject { get; }
property Project^ ContainingProject {
    Project^ get ();
}
abstract ContainingProject : Project with get
function get ContainingProject () : Project

Valeur de propriété

Type : Project
Retourne un objet Project.

Notes

Utilisez cette propriété pour récupérer l'objet Project qui inclut l'élément.

Exemples

L'exemple suivant montre comment utiliser une macro-fonction privée pour récupérer le nom du projet dont fait partie l'élément de projet. Une méthode de test est créée pour utiliser cette fonction.

' Macro Editor 
Imports VSLangProj
Private Function GetProjectName(ByVal refs As References) _
   As String
   Return refs.ContainingProject.Name
End Function
    
Sub TestGetProjectName()
   ' First project is a Visual Basic or C# project.
   Dim theVSProject As VSProject = _
      CType(DTE.Solution.Projects.Item(1).Object, VSProject)
   Dim refs As References = theVSProject.References
   MsgBox(GetProjectName(refs))
End Sub

Sécurité .NET Framework

Voir aussi

Référence

Reference Interface

VSLangProj, espace de noms