TypeProvider.AddAssemblyReference(String) 方法

定义

将对 Assembly 的引用添加到内部列表。Adds a reference to the Assembly to the internal list. 此程序集用于在 Type 方法中查找 GetType(String)This assembly is used for the Type lookup in the GetType(String) method.

public:
 void AddAssemblyReference(System::String ^ path);
public void AddAssemblyReference (string path);
member this.AddAssemblyReference : string -> unit
Public Sub AddAssemblyReference (path As String)

参数

path
String

要添加的 Assembly 的路径。The path of the Assembly to add.

例外

path 为空引用(在 Visual Basic 中为 Nothing)。path is a null reference (Visual Basic Nothing).

示例

下面的代码示例演示如何创建 TypeProvider 类的新实例并运行 AddAssemblyReference 方法。The following code example shows how to create a new instance of the TypeProvider class and run the AddAssemblyReference method. 此代码示例摘自 WorkflowLoader.cs 文件中的 BasicDesignerHosting SDK 示例。This code example is part of the BasicDesignerHosting SDK Sample from the WorkflowLoader.cs file. 有关详细信息,请参阅基本设计器宿主For more information, see Basic Designer Hosting.

TypeProvider typeProvider = new TypeProvider(host);
typeProvider.AddAssemblyReference(typeof(string).Assembly.Location);
Dim typeProvider As TypeProvider = New TypeProvider(host)
typeProvider.AddAssemblyReference(GetType(String).Assembly.Location)

适用于