Evidence.AddHost(Object) 方法

定义

注意

现已弃用此 API。

注意

This method is obsolete. Please use AddHostEvidence instead.

注意

Evidence.AddHost has been deprecated. Use AddHostEvidence instead.

将主机提供的指定证据添加到证据集。

public:
 void AddHost(System::Object ^ id);
[System.Obsolete]
public void AddHost (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>]
member this.AddHost : obj -> unit
[<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
Public Sub AddHost (id As Object)

参数

id
Object

任意证据对象。

属性

例外

id 为 null。

id 不可序列化。

示例

下面的代码示例演示如何使用 AddHost 方法。 此示例是为 类提供的更大示例的一 Evidence 部分。

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

注解

将此方法用于主机提供的证据。

注意

此方法不执行检查以防止添加重复类型的证据。 许多宿主证据对象可以同时存在。

适用于