Exception.Source Property

 

Gets or sets the name of the application or the object that causes the error.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

abstract Source : string with get, set
override Source : string with get, set

Property Value

Type: System.String

The name of the application or the object that causes the error.

Exception Condition
ArgumentException

The object must be a runtime System.Reflection object

If the Source property is not set explicitly, the runtime automatically sets it to the name of the assembly in which the exception originated.

The following example throws an Exception that sets the Source property in its constructor and then catches the exception and displays Source.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show: