共用方式為


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

備註

指定辨識項集中的每個辨識項物件都會根據目前辨識項集的來源集合,新增至目前辨識項集的元件和主機集合。

注意

此方法不會執行檢查,以防止新增重複類型的辨識項。 許多元件和主機辨識項物件可以同時存在。

適用於