Читати англійською Редагувати

Поділитися через


Evidence Constructors

Definition

Initializes a new instance of the Evidence class.

Overloads

Evidence()

Initializes a new empty instance of the Evidence class.

Evidence(Evidence)

Initializes a new instance of the Evidence class from a shallow copy of an existing one.

Evidence(Object[], Object[])
Obsolete.
Obsolete.
Obsolete.

Initializes a new instance of the Evidence class from multiple sets of host and assembly evidence.

Evidence(EvidenceBase[], EvidenceBase[])

Initializes a new instance of the Evidence class from multiple sets of host and assembly evidence.

Evidence()

Source:
Evidence.cs

Initializes a new empty instance of the Evidence class.

C#
public Evidence();

Examples

The following code example shows the use of the Evidence() constructor. This example is part of a larger example provided for the Evidence class.

C#
Evidence ev1 = new Evidence();
Console.WriteLine("Created empty evidence with the default constructor.");

Applies to

.NET 10 та інші версії
Продукт Версії
.NET 6 (package-provided), 6, 7 (package-provided), 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5

Evidence(Evidence)

Source:
Evidence.cs

Initializes a new instance of the Evidence class from a shallow copy of an existing one.

C#
public Evidence(System.Security.Policy.Evidence evidence);

Parameters

evidence
Evidence

The Evidence instance from which to create the new instance. This instance is not deep-copied.

Exceptions

The evidence parameter is not a valid instance of Evidence.

Examples

The following code example shows the use of the Evidence(Evidence) constructor. This example is part of a larger example provided for the Evidence class.

C#
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));

Applies to

.NET 10 та інші версії
Продукт Версії
.NET 6 (package-provided), 6, 7 (package-provided), 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5

Evidence(Object[], Object[])

Source:
Evidence.cs

Caution

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

Caution

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

Caution

This API is now deprecated.

Initializes a new instance of the Evidence class from multiple sets of host and assembly evidence.

C#
[System.Obsolete("This constructor is obsolete. Use the constructor which accepts arrays of EvidenceBase instead.")]
public Evidence(object[] hostEvidence, object[] assemblyEvidence);
C#
[System.Obsolete("This constructor is obsolete. Please use the constructor which takes arrays of EvidenceBase instead.")]
public Evidence(object[] hostEvidence, object[] assemblyEvidence);
C#
public Evidence(object[] hostEvidence, object[] assemblyEvidence);
C#
[System.Obsolete]
public Evidence(object[] hostEvidence, object[] assemblyEvidence);

Parameters

hostEvidence
Object[]

The host evidence from which to create the new instance.

assemblyEvidence
Object[]

The assembly evidence from which to create the new instance.

Attributes

Examples

The following code example shows the use of the Evidence(Object[], Object[]) constructor. This example is part of a larger example provided for the Evidence class.

C#
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());

Applies to

.NET 10 та інші версії
Продукт Версії (Застаріло.)
.NET (6 (package-provided), 6, 7 (package-provided), 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10)
.NET Framework 1.1, 2.0, 3.0, 3.5 (4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1)
.NET Standard (2.0 (package-provided))
Windows Desktop (3.0, 3.1, 5, 6, 7, 8, 9, 10)

Evidence(EvidenceBase[], EvidenceBase[])

Source:
Evidence.cs

Initializes a new instance of the Evidence class from multiple sets of host and assembly evidence.

C#
public Evidence(System.Security.Policy.EvidenceBase[] hostEvidence, System.Security.Policy.EvidenceBase[] assemblyEvidence);

Parameters

hostEvidence
EvidenceBase[]

The host evidence from which to create the new instance.

assemblyEvidence
EvidenceBase[]

The assembly evidence from which to create the new instance.

Remarks

This constructor creates a new instance of the class by using evidence objects that inherit from the EvidenceBase class.

Applies to

.NET 10 та інші версії
Продукт Версії
.NET 6 (package-provided), 6, 7 (package-provided), 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5