C# Class ObjectPrinter.ExceptionExtensions

Extensions for exceptions
Show file Open project: drewburlingame/ObjectPrinter

Public Methods

Method Description
SetContext ( this e, string name, object context, bool ifNotSerializablePrintOnSerialize = true ) : void

Adds context in the form of objects to the Data property of an exception. This context will be printed with the exception.

Method Details

SetContext() public static method

Adds context in the form of objects to the Data property of an exception. This context will be printed with the exception.
public static SetContext ( this e, string name, object context, bool ifNotSerializablePrintOnSerialize = true ) : void
e this The exception to add context to
name string The name to describe the context
context object The context item.
ifNotSerializablePrintOnSerialize bool /// When true, if the object is not serializable, the object will be dumped /// to string and added to the exception before serialization. default=true ///
return void