References.Find(String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在项目中搜索具有指定的对象的引用 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
参数
返回
返回一个 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 都有一个 Identity 。 Find方法搜索并返回 Reference 具有指定的对象 Identity 。