2

I have define a callback field and event property for it:

private Action<int, int, TaskCallbackArgs> _callbackEvent    
/// <summary>
/// Provides a callback event for task.
/// </summary>
public event Action<int, int, TaskCallbackArgs> CallbackEvent
{
  add
  {
    _callbackEvent += value;
  }
  remove
  {
    _callbackEvent -= value;
  }
}

In my code I have invoke the _callbackEvent. All right, but when I type _callbackEvent( VS show me IntelliSense that my method want (int arg1, int arg2, TaskCallbackArgs arg3) arguments. When I open this code some time later I don't remember what is arg1, arg2 and arg3.

Is there a way to use XML Documentation for field as following?

/// <summary>
/// Description
/// </summary>
/// <param name="current">Param description...</param>
/// <param name="total">Param description...</param>
/// <param name="additional">Param description...</param>

Thanks!

1 Answer 1

1

Action<int, int, TaskCallbackArgs> is a delegate type that takes three parameters.
You can write an XML doc comment for the field, but that will only apply to the field itself.

To add parameter names and doc comments for the delegate parameters, you need to create your own delegate type.

For example:

/// <summary>
/// Description
/// </summary>
/// <param name="current">Param description...</param>
/// <param name="total">Param description...</param>
/// <param name="additional">Param description...</param>
public delegate void CallbackHandler(int current, int total, TaskCallbackArgs additional);
Sign up to request clarification or add additional context in comments.

1 Comment

When I was writing this code I was thinking that I save my time using general delegates, but I had wrong :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.