語言

DiscoveryExceptionDictionary.Add(String, Exception) 方法

定義

將 與 鍵 加入 ExceptionurlDiscoveryExceptionDictionary。

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

參數

url
String

在 XML Web 服務發現過程中導致異常的 URL。

value
Exception

Exception那是在 XML Web 服務發現過程中發生的。

例外狀況

url 是 null。

在 中url已經存在一個鍵為 的DiscoveryExceptionDictionary元素。

範例

DiscoveryExceptionDictionary^ myNewExceptionDictionary = gcnew DiscoveryExceptionDictionary;

// Add an exception with the custom error message.
Exception^ myNewException = gcnew Exception( "The requested service is not available." );
myNewExceptionDictionary->Add( myUrlKey, myNewException );
myExceptionDictionary = myNewExceptionDictionary;
DiscoveryExceptionDictionary myNewExceptionDictionary =
                           new DiscoveryExceptionDictionary();
// Add an exception with the custom error message.
Exception myNewException =
     new Exception("The requested service is not available.");
myNewExceptionDictionary.Add(myUrlKey, myNewException);
myExceptionDictionary = myNewExceptionDictionary;
Dim myNewExceptionDictionary As New DiscoveryExceptionDictionary()
' Add an exception with the custom error message.
Dim myNewException As New Exception("The requested service is not available.")
myNewExceptionDictionary.Add(myUrlKey, myNewException)
myExceptionDictionary = myNewExceptionDictionary

適用於

另請參閱