Επεξεργασία

Κοινή χρήση μέσω


Evidence.AddHost(Object) Method

Definition

Caution

This method is obsolete. Please use AddHostEvidence instead.

Caution

Evidence.AddHost has been deprecated. Use AddHostEvidence instead.

Caution

This API is now deprecated.

Adds the specified evidence supplied by the host to the evidence set.

public:
 void AddHost(System::Object ^ id);
[System.Obsolete("This method is obsolete. Please use AddHostEvidence instead.")]
public void AddHost (object id);
[System.Obsolete("Evidence.AddHost has been deprecated. Use AddHostEvidence instead.")]
public void AddHost (object id);
public void AddHost (object id);
[System.Obsolete]
public void AddHost (object id);
[<System.Obsolete("This method is obsolete. Please use AddHostEvidence instead.")>]
member this.AddHost : obj -> unit
[<System.Obsolete("Evidence.AddHost has been deprecated. Use AddHostEvidence instead.")>]
member this.AddHost : obj -> unit
member this.AddHost : obj -> unit
[<System.Obsolete>]
member this.AddHost : obj -> unit
Public Sub AddHost (id As Object)

Parameters

id
Object

Any evidence object.

Attributes

Exceptions

id is null.

id is not serializable.

Examples

The following code example shows the use of the AddHost method. This example is part of a larger example provided for the Evidence class.

Url^ url = gcnew Url( "http://www.treyresearch.com" );
Console::WriteLine( "Adding host evidence {0}", url );
ev2a->AddHost( url );
Evidence^ ev2b = gcnew Evidence( ev2a );
Console::WriteLine( "Copy evidence into new evidence" );
IEnumerator^ enum1 = ev2b->GetHostEnumerator();
enum1->MoveNext();
Console::WriteLine( enum1->Current );
Url url = new Url("http://www.treyresearch.com");
Console.WriteLine("Adding host evidence " + url.ToString());
ev2a.AddHost(url);
Evidence ev2b = new Evidence(ev2a);
Console.WriteLine("Copy evidence into new evidence");
IEnumerator enum1 = ev2b.GetHostEnumerator();
enum1.MoveNext();
Console.WriteLine(enum1.Current.ToString());
Dim url As New Url("http://www.treyresearch.com")
Console.WriteLine(("Adding host evidence " & url.ToString()))
ev2a.AddHost(url)
Dim ev2b As New Evidence(ev2a)
Console.WriteLine("Copy evidence into new evidence")
Dim enum1 As IEnumerator = ev2b.GetHostEnumerator()
enum1.MoveNext()
Console.WriteLine(enum1.Current.ToString())

Remarks

Use this method for evidence supplied by the host.

Note

This method does not perform a check to prevent adding duplicate types of evidence. Many host evidence objects can exist at the same time.

Applies to