Restarring Delegate Annotations?

I am trying to create an external annotation file for Commons.Logging. This is almost a direct copy from the log4net configuration, but what puzzles me is how I can decorate the following code appropriately StringFormatMethodAttribute:

public interface ILog
{
  void Error(Action<FormatMessageHandler> formatMessageCallback);
}

public delegate string FormatMessageHandler(string format, params object[] args);

// usage
log.Error(m => m(
  "my expensive to calculate argument is: {0}",
    CalculateMessageInfo()) );

The attribute is valid only for constructors and methods, is there a way to force it to use this use case?

+5
source share

All Articles