Evidence.Merge(Evidence) 方法

定义

将指定的证据集合并到当前证据集。Merges the specified evidence set into the current evidence set.

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

参数

evidence
Evidence

要合并到当前证据集的证据集。The evidence set to be merged into the current evidence set.

异常

evidence 参数不是 Evidence 的有效实例。The evidence parameter is not a valid instance of Evidence.

Lockedtrue,调用该方法的代码不具有 ControlEvidence,并且 evidence 参数具有一个不为空的主机列表。Locked is true, the code that calls this method does not have ControlEvidence, and the evidence parameter has a host list that is not empty.

示例

下面的代码示例演示如何使用 Merge 方法。The following code example shows the use of the Merge method. 此示例是为 Evidence 类提供的更大示例的一部分。This example is part of a larger example provided for the Evidence class.

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()))

注解

指定证据集中的每个证据对象都会根据其来源的集添加到当前证据集的程序集和主机集。Each evidence object in the specified evidence set is added to the assembly and host sets of the current evidence set, according to the sets from which it came.

备注

此方法不执行检查来阻止添加重复类型的证据。This method does not perform a check to prevent adding duplicate types of evidence. 许多程序集和主机证据对象可以同时存在。Many assembly and host evidence objects can exist at the same time.

安全性

SecurityPermission
为了能够在 Locked @no__t 时操作证据,evidence 参数的主机列表不为空。for the ability to manipulate evidence when Locked is true and the evidence parameter has a host list that is not empty. 关联的枚举: ControlEvidenceAssociated enumeration: ControlEvidence

适用于