Share via


References.Find Method

Searches the references in a project for an object that has the specified Identity.

Namespace:  VSLangProj
Assembly:  VSLangProj (in VSLangProj.dll)

Syntax

'Declaration
Function Find ( _
    bstrIdentity As String _
) As Reference
Reference Find(
    string bstrIdentity
)
Reference^ Find(
    [InAttribute] String^ bstrIdentity
)
abstract Find : 
        bstrIdentity:string -> Reference
function Find(
    bstrIdentity : String
) : Reference

Parameters

Return Value

Type: VSLangProj.Reference
Returns a Reference object.

Remarks

Each Reference object in the References collection has an Identity. The Find method searches for and returns the Reference object with the specified Identity.

Examples

' Macro Editor
Imports VSLangProj
Public Sub FindExample()
   ' 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
   Dim firstIdentity As String = refs.Item(1).Identity
   Dim firstRef As Reference = refs.Find(firstIdentity)
   ' Are they the same object?
   Dim isSame As Boolean = (firstRef.Identity = refs.Item(1).Identity)
   MsgBox("Are they the same? " & isSame.ToString())
End Sub   

.NET Framework Security

See Also

Reference

References Interface

VSLangProj Namespace