C# Exception ToString
Description
Exception ToString
creates and returns a string representation
of the current exception.
Syntax
Exception.ToString
has the following syntax.
public override string ToString()
Returns
Exception.ToString
method returns A string representation of the current exception.
Example
using System;/*from www. j a va2 s.c o m*/
public class MainClass{
public static void Main(String[] argv){
Exception e = new Exception("asdf");
System.Console.WriteLine(e.ToString());
}
}
The code above generates the following result.