Επεξεργασία

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


DiscoveryClientDocumentCollection.Add(String, Object) Method

Definition

Adds an object with the specified URL to the DiscoveryClientDocumentCollection.

public:
 void Add(System::String ^ url, System::Object ^ value);
public void Add (string url, object value);
member this.Add : string * obj -> unit
Public Sub Add (url As String, value As Object)

Parameters

url
String

The URL for the document to add to the DiscoveryClientDocumentCollection.

value
Object

A discovered document to add to the DiscoveryClientDocumentCollection.

Exceptions

url is null.

An entry with a key of url already exists in the DiscoveryClientDocumentCollection.

Examples

The following code example adds two discovery documents to a DiscoveryClientDocumentCollection.

DiscoveryClientDocumentCollection^ myDiscoveryClientDocumentCollection = gcnew DiscoveryClientDocumentCollection;

DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument;
String^ myStringUrl = "http://www.contoso.com/service.disco";
String^ myStringUrl1 = "http://www.contoso.com/service1.disco";
myDiscoveryClientDocumentCollection->Add( myStringUrl, myDiscoveryDocument );
myDiscoveryClientDocumentCollection->Add( myStringUrl1, myDiscoveryDocument );
DiscoveryClientDocumentCollection myDiscoveryClientDocumentCollection =
   new DiscoveryClientDocumentCollection();
DiscoveryDocument myDiscoveryDocument = new DiscoveryDocument();
string myStringUrl = "http://www.contoso.com/service.disco";
string myStringUrl1 = "http://www.contoso.com/service1.disco";

myDiscoveryClientDocumentCollection.Add(myStringUrl, myDiscoveryDocument);
myDiscoveryClientDocumentCollection.Add(myStringUrl1, myDiscoveryDocument);
Dim myDiscoveryClientDocumentCollection As New DiscoveryClientDocumentCollection()
Dim myDiscoveryDocument As New DiscoveryDocument()
Dim myStringUrl As String = "http://www.contoso.com/service.disco"
Dim myStringUrl1 As String = "http://www.contoso.com/service1.disco"

myDiscoveryClientDocumentCollection.Add(myStringUrl, myDiscoveryDocument)
myDiscoveryClientDocumentCollection.Add(myStringUrl1, myDiscoveryDocument)

Applies to

See also