共用方式為


References.Find 方法

在專案中的所有參考內搜尋具有指定 Identity 的物件。

命名空間:  VSLangProj
組件:  VSLangProj (在 VSLangProj.dll 中)

語法

'宣告
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

參數

傳回值

類型:VSLangProj.Reference
傳回 Reference 物件。

備註

References 集合中的每一個 Reference 物件都有一個 IdentityFind 方法會搜尋具有指定 IdentityReference 物件並將其傳回。

範例

' 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 安全性

請參閱

參考

References 介面

VSLangProj 命名空間