References.Find(String) 方法

定义

在项目中搜索具有指定的对象的引用 Identity

public:
 VSLangProj::Reference ^ Find(System::String ^ bstrIdentity);
public:
 VSLangProj::Reference ^ Find(Platform::String ^ bstrIdentity);
VSLangProj::Reference Find(std::wstring const & bstrIdentity);
[System.Runtime.InteropServices.DispId(5)]
public VSLangProj.Reference Find (string bstrIdentity);
[<System.Runtime.InteropServices.DispId(5)>]
abstract member Find : string -> VSLangProj.Reference
Public Function Find (bstrIdentity As String) As Reference

参数

bstrIdentity
String

必需。 Identity 对象的 Reference

返回

Reference

返回一个 Reference 对象。

属性

示例

' 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     

注解

集合中的每个 Reference 对象 References 都有一个 IdentityFind方法搜索并返回 Reference 具有指定的对象 Identity

适用于