共用方式為


Evidence 建構函式

定義

初始化 Evidence 類別的新執行個體。

多載

Evidence()

初始化 Evidence 類別的新的空執行個體。

Evidence(Evidence)

從現有物件的淺層複本 (Shallow Copy) 初始化 Evidence 類別的新執行個體。

Evidence(Object[], Object[])
已淘汰.
已淘汰.
已淘汰.

從多重主應用程式和組件辨識項集合初始化 Evidence 類別的新執行個體。

Evidence(EvidenceBase[], EvidenceBase[])

從多重主應用程式和組件辨識項集合初始化 Evidence 類別的新執行個體。

Evidence()

初始化 Evidence 類別的新的空執行個體。

public:
 Evidence();
public Evidence ();
Public Sub New ()

範例

下列程式代碼範例示範建構函式的使用 Evidence() 方式。 此範例是針對 類別提供的較大範例的 Evidence 一部分。

Evidence^ ev1 = gcnew Evidence;
Console::WriteLine( "Created empty evidence with the default constructor." );
Evidence ev1 = new Evidence();
Console.WriteLine("Created empty evidence with the default constructor.");
Dim ev1 As New Evidence
Console.WriteLine("Created empty evidence with the default constructor.")

適用於

Evidence(Evidence)

從現有物件的淺層複本 (Shallow Copy) 初始化 Evidence 類別的新執行個體。

public:
 Evidence(System::Security::Policy::Evidence ^ evidence);
public Evidence (System.Security.Policy.Evidence evidence);
new System.Security.Policy.Evidence : System.Security.Policy.Evidence -> System.Security.Policy.Evidence
Public Sub New (evidence As Evidence)

參數

evidence
Evidence

Evidence 執行個體,用來建立新的執行個體。 這個執行個體不會深層複製。

例外狀況

evidence 參數不是 Evidence 的有效執行個體。

範例

下列程式代碼範例示範建構函式的使用 Evidence(Evidence) 方式。 此範例是針對 類別提供的較大範例的 Evidence 一部分。

Console::WriteLine( "\nMake a copy of the current evidence." );
Evidence^ evidenceCopy = gcnew Evidence( myEvidence );
Console::WriteLine( "Count of new evidence items = {0}", evidenceCopy->Count );
Console::WriteLine( "Does the copy equal the current evidence? {0}", myEvidence->Equals( evidenceCopy ) );
Console.WriteLine("\nMake a copy of the current evidence.");
Evidence evidenceCopy = new Evidence(myEvidence);
Console.WriteLine("Count of new evidence items = " + evidenceCopy.Count);
Console.WriteLine("Does the copy equal the current evidence? " + myEvidence.Equals(evidenceCopy));
Console.WriteLine(ControlChars.Lf & "Make a copy of the current evidence.")
Dim evidenceCopy As New Evidence(myEvidence)
Console.WriteLine(("Count of new evidence items = " & evidenceCopy.Count.ToString()))
Console.WriteLine(("Does the copy equal the current evidence? " & myEvidence.Equals(evidenceCopy)))

適用於

Evidence(Object[], Object[])

警告

This constructor is obsolete. Use the constructor which accepts arrays of EvidenceBase instead.

警告

This constructor is obsolete. Please use the constructor which takes arrays of EvidenceBase instead.

警告

此 API 現已淘汰。

從多重主應用程式和組件辨識項集合初始化 Evidence 類別的新執行個體。

public:
 Evidence(cli::array <System::Object ^> ^ hostEvidence, cli::array <System::Object ^> ^ assemblyEvidence);
[System.Obsolete("This constructor is obsolete. Use the constructor which accepts arrays of EvidenceBase instead.")]
public Evidence (object[] hostEvidence, object[] assemblyEvidence);
public Evidence (object[] hostEvidence, object[] assemblyEvidence);
[System.Obsolete("This constructor is obsolete. Please use the constructor which takes arrays of EvidenceBase instead.")]
public Evidence (object[] hostEvidence, object[] assemblyEvidence);
[System.Obsolete]
public Evidence (object[] hostEvidence, object[] assemblyEvidence);
[<System.Obsolete("This constructor is obsolete. Use the constructor which accepts arrays of EvidenceBase instead.")>]
new System.Security.Policy.Evidence : obj[] * obj[] -> System.Security.Policy.Evidence
new System.Security.Policy.Evidence : obj[] * obj[] -> System.Security.Policy.Evidence
[<System.Obsolete("This constructor is obsolete. Please use the constructor which takes arrays of EvidenceBase instead.")>]
new System.Security.Policy.Evidence : obj[] * obj[] -> System.Security.Policy.Evidence
[<System.Obsolete>]
new System.Security.Policy.Evidence : obj[] * obj[] -> System.Security.Policy.Evidence
Public Sub New (hostEvidence As Object(), assemblyEvidence As Object())

參數

hostEvidence
Object[]

用來建立新執行個體的主應用程式辨識項。

assemblyEvidence
Object[]

用來建立新執行個體的組件辨識項。

屬性

範例

下列程式代碼範例示範建構函式的使用 Evidence(Object[], Object[]) 方式。 此範例是針對 類別提供的較大範例的 Evidence 一部分。

array<Object^>^oa1 = {};
Site^ site = gcnew Site( "www.wideworldimporters.com" );
array<Object^>^oa2 = {url,site};
Evidence^ ev3a = gcnew Evidence( oa1,oa2 );
enum1 = ev3a->GetHostEnumerator();
IEnumerator^ enum2 = ev3a->GetAssemblyEnumerator();
enum2->MoveNext();
Object^ obj1 = enum2->Current;
enum2->MoveNext();
Console::WriteLine( "URL = {0}  Site = {1}", obj1, enum2->Current );
Object [] oa1 = {};
Site site = new Site("www.wideworldimporters.com");
Object [] oa2 = { url, site };
Evidence ev3a = new Evidence(oa1, oa2);
enum1 = ev3a.GetHostEnumerator();
IEnumerator enum2 = ev3a.GetAssemblyEnumerator();
enum2.MoveNext();
Object obj1 = enum2.Current;
enum2.MoveNext();
Console.WriteLine("URL = " + obj1.ToString() + "  Site = " + enum2.Current.ToString());
Dim oa1() As [Object]
Dim site As New Site("www.wideworldimporters.com")
Dim oa2 As [Object]() = {url, site}
Dim ev3a As New Evidence(oa1, oa2)
enum1 = ev3a.GetHostEnumerator()
Dim enum2 As IEnumerator = ev3a.GetAssemblyEnumerator()
enum2.MoveNext()
Dim obj1 As [Object] = enum2.Current
enum2.MoveNext()
Console.WriteLine(("URL = " & obj1.ToString() & "  Site = " & enum2.Current.ToString()))

適用於

Evidence(EvidenceBase[], EvidenceBase[])

從多重主應用程式和組件辨識項集合初始化 Evidence 類別的新執行個體。

public:
 Evidence(cli::array <System::Security::Policy::EvidenceBase ^> ^ hostEvidence, cli::array <System::Security::Policy::EvidenceBase ^> ^ assemblyEvidence);
public Evidence (System.Security.Policy.EvidenceBase[] hostEvidence, System.Security.Policy.EvidenceBase[] assemblyEvidence);
new System.Security.Policy.Evidence : System.Security.Policy.EvidenceBase[] * System.Security.Policy.EvidenceBase[] -> System.Security.Policy.Evidence
Public Sub New (hostEvidence As EvidenceBase(), assemblyEvidence As EvidenceBase())

參數

hostEvidence
EvidenceBase[]

用來建立新執行個體的主應用程式辨識項。

assemblyEvidence
EvidenceBase[]

用來建立新執行個體的組件辨識項。

備註

這個建構函式會使用繼承自 EvidenceBase 類別的辨識項物件,建立類別的新實例。

適用於