Evidence 构造函数

定义

初始化 Evidence 类的新实例。

重载

Evidence()

初始化 Evidence 类的新的空实例。

Evidence(Evidence)

从现有证据的浅表副本初始化 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)

从现有证据的浅表副本初始化 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 类的证据对象创建 类的新实例。

适用于