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.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version