// dnlib: See LICENSE.txt for more info namespace dnlib.DotNet.Writer { /// /// Gets notified of errors. The default handler should normally throw since the written data /// will probably be invalid. Any error can be ignored. /// public interface IWriterError { /// /// Called when an error is detected (eg. a null pointer or other invalid value). The error /// can be ignored but the written data won't be valid. /// /// Error message void Error(string message); } /// /// Gets notified of errors. The default handler should normally throw since the written data /// will probably be invalid. Any error can be ignored. /// public interface IWriterError2 : IWriterError { /// /// Called when an error is detected (eg. a null pointer or other invalid value). The error /// can be ignored but the written data won't be valid. /// /// Error message /// Optional message arguments void Error(string message, params object[] args); } static partial class Extensions { /// /// Called when an error is detected (eg. a null pointer or other invalid value). The error /// can be ignored but the written data won't be valid. /// /// The instance of /// Error message /// Optional message arguments internal static void Error2(this IWriterError helper, string message, params object[] args) { if (helper is IWriterError2 helper2) helper2.Error(message, args); else helper.Error(string.Format(message, args)); } } }