AddInStore.FindAddIn(Type, String, String, String) 方法

定義

尋找特定的增益集。

public:
 static System::Collections::ObjectModel::Collection<System::AddIn::Hosting::AddInToken ^> ^ FindAddIn(Type ^ hostViewOfAddIn, System::String ^ pipelineRootFolderPath, System::String ^ addInFilePath, System::String ^ addInTypeName);
[System.Security.SecurityCritical]
public static System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken> FindAddIn (Type hostViewOfAddIn, string pipelineRootFolderPath, string addInFilePath, string addInTypeName);
[<System.Security.SecurityCritical>]
static member FindAddIn : Type * string * string * string -> System.Collections.ObjectModel.Collection<System.AddIn.Hosting.AddInToken>
Public Shared Function FindAddIn (hostViewOfAddIn As Type, pipelineRootFolderPath As String, addInFilePath As String, addInTypeName As String) As Collection(Of AddInToken)

參數

hostViewOfAddIn
Type

定義增益集之裝載檢視的型別。

pipelineRootFolderPath
String

管線目錄結構的根目錄路徑。

addInFilePath
String

要尋找的增益集路徑和檔案名稱。

addInTypeName
String

增益集的類型名稱。

傳回

語彙基元的集合,只包含代表已找到之增益集的語彙基元。

屬性

例外狀況

pipelineRootFolderPathaddInFilePathaddInTypeName 的長度為零。

-或-

增益集檔案不存在於 addInfilePath

一或多個參數為 null

呼叫端沒有 pipelineRootFolderPath

範例

下列範例會尋找特定的載入宏。

// Find a specific add-in.

// Construct the path to the add-in.
string addInFilePath = pipeRoot + @"\AddIns\P3AddIn2\P3AddIn2.dll";

// The fourth parameter, addinTypeName, takes the full name
// of the type qualified by its namespace. Same as AddInToken.AddInFullName.
Collection<AddInToken> tokenColl = AddInStore.FindAddIn(typeof(Calculator),
    pipeRoot, addInFilePath, "CalcAddIns.P3AddIn2");
Console.WriteLine("Found {0}", tokenColl[0].Name);
' Find a specific add-in.
' Construct the path to the add-in.
Dim addInFilePath As String = (pipeRoot + "\AddIns\P3AddIn2\P3AddIn2.dll")
' The fourth parameter, addinTypeName, takes the full name 
' of the type qualified by its namespace. Same as AddInToken.AddInFullName.
Dim tokenColl As System.Collections.ObjectModel.Collection(Of AddInToken) = AddInStore.FindAddIn(GetType(Calculator), pipeRoot, addInFilePath, "CalcAddIns.P3AddIn2")
Console.WriteLine("Found {0}", tokenColl(0).Name)

備註

如果找到載入宏的單一管線,它會是集合中 AddInToken 唯一的專案。 如果找到指定載入宏的多個管線,您可以檢查 QualificationData 屬性來區分它們。

適用於

另請參閱