C# Exception HelpLink
Description
Exception HelpLink
gets or sets a link to the help file
associated with this exception.
Syntax
Exception.HelpLink
has the following syntax.
public virtual string HelpLink { get; set; }
Example
The following code example throws an Exception that sets the HelpLink property.
/*from www . j ava 2s.c o m*/
using System;
using System.Collections;
class Sample
{
public static void Main()
{
try {
Exception e = new Exception("This statement is the original exception message.");
string s = "Information.";
int i = -903;
DateTime dt = DateTime.Now;
e.Data.Add("stringInfo", s);
e.Data["IntInfo"] = i;
e.Data["DateTimeInfo"] = dt;
e.HelpLink = "http://java2s.com";
throw e;
}
catch (Exception e) {
Console.WriteLine("An exception was thrown.");
Console.WriteLine(e.Message);
if (e.Data.Count > 0) {
Console.WriteLine(" Extra details:");
foreach (DictionaryEntry de in e.Data)
Console.WriteLine(" Key: {0,-20} Value: {1}",
"'" + de.Key.ToString() + "'", de.Value);
}
}
}
}
The code above generates the following result.