Evidence.Merge(Evidence) 方法

定义

将指定的证据集合并到当前证据集。

public:
 void Merge(System::Security::Policy::Evidence ^ evidence);
public void Merge (System.Security.Policy.Evidence evidence);
member this.Merge : System.Security.Policy.Evidence -> unit
Public Sub Merge (evidence As Evidence)

参数

evidence
Evidence

要合并到当前证据集的证据集。

例外

evidence 参数不是 Evidence 的有效实例。

Lockedtrue,调用该方法的代码不具有 ControlEvidence,并且 evidence 参数具有一个不为空的主机列表。

示例

下面的代码示例演示如何使用 Merge 方法。 此示例是为 类提供的更大示例的 Evidence 一部分。

Console::WriteLine( "\nMerge new evidence with the current evidence." );
array<Object^>^oa1 = {};
Site^ site = gcnew Site( "www.wideworldimporters.com" );
array<Object^>^oa2 = {url,site};
Evidence^ newEvidence = gcnew Evidence( oa1,oa2 );
myEvidence->Merge( newEvidence );
Console::WriteLine( "Evidence count = {0}", PrintEvidence( myEvidence ) );
Console.WriteLine("\nMerge new evidence with the current evidence.");
Object [] oa1 = {};
Site site = new Site("www.wideworldimporters.com");
Object [] oa2 = { url, site };
Evidence newEvidence = new Evidence(oa1, oa2);
myEvidence.Merge(newEvidence);
Console.WriteLine("Evidence count = " + PrintEvidence(myEvidence).ToString());
Console.WriteLine(ControlChars.Lf & "Merge new evidence with the current evidence.")
Dim oa1() As [Object]
Dim site As New Site("www.wideworldimporters.com")
Dim oa2 As [Object]() = {url, site}
Dim newEvidence As New Evidence(oa1, oa2)
myEvidence.Merge(newEvidence)

Console.WriteLine(("Evidence count = " & PrintEvidence(myEvidence).ToString()))

注解

指定证据集中的每个证据对象都根据当前证据集的集合添加到程序集和主机集。

注意

此方法不执行检查以防止添加重复类型的证据。 许多程序集和宿主证据对象可以同时存在。

适用于