Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Member Functions | List of all members
Loyc.MessageSinkFromDelegate Class Reference

This helper class lets you implement IMessageSink with one or two delegates (a writer method, and an optional severity filter). More...


Source file:
Inheritance diagram for Loyc.MessageSinkFromDelegate:
Loyc.IMessageSink

Remarks

This helper class lets you implement IMessageSink with one or two delegates (a writer method, and an optional severity filter).

Public Member Functions

 MessageSinkFromDelegate (WriteMessageFn writer, Func< Severity, bool > isEnabled=null)
 Initializes this object. More...
 
void Write (Severity type, object context, string format)
 Writes a message to the target that this object represents. More...
 
void Write (Severity type, object context, string format, object arg0, object arg1=null)
 
void Write (Severity type, object context, string format, params object[] args)
 
bool IsEnabled (Severity type)
 Returns true if messages of the specified type will actually be printed, or false if Write(type, ...) is a no-op. More...
 

Constructor & Destructor Documentation

Loyc.MessageSinkFromDelegate.MessageSinkFromDelegate ( WriteMessageFn  writer,
Func< Severity, bool >  isEnabled = null 
)
inline

Initializes this object.

Parameters
writerRequired. A method that accepts output.
isEnabledOptional. A method that decides whether to output based on the message type. If this parameter is provided, then Write() will not invoke the writer when isEnabled returns false. This delegate is also called by IsEnabled().

Member Function Documentation

bool Loyc.MessageSinkFromDelegate.IsEnabled ( Severity  type)
inline

Returns true if messages of the specified type will actually be printed, or false if Write(type, ...) is a no-op.

Implements Loyc.IMessageSink.

Referenced by Loyc.MessageSinkFromDelegate.Write().

void Loyc.MessageSinkFromDelegate.Write ( Severity  type,
object  context,
string  format 
)
inline

Writes a message to the target that this object represents.

Parameters
typeSeverity or importance of the message; widely-used types include Error, Warning, Note, Debug, and Verbose. The special type Detail is intended to provide more information about a previous message.
contextAn object that the message is related to, or that represents the location that the message applies to. The message sink may try to convert this object to a string and include it in its output. See also MessageSink.LocationString().
formatA message to display. If there are additional arguments, placeholders such as {0} and {1} refer to these arguments.

Implements Loyc.IMessageSink.

References Loyc.MessageSinkFromDelegate.IsEnabled().