Search code examples
c#tooltip

Is it possible to set an override to tooltip and set it to a method with parameters


I want to know if it possible to set a ToolTip to a method with parameters to additionally describe what the method is doing and what parameters is it using, so that when it is used by another developer be will informed of the method purpose and usage properly, or by adding additional requirement like converting values to be used as parameters.

Like when converting to Int32 like in this screen shot:

enter image description here

What I want is to find out if it possible to do the same thing for custom methods, where we can tell the developer who is using the method what the method is doing and if he need to cast any parameters and if there is an overloading for the method, by may be setting a tooltip to the method somehow, while I know that tooltips can be only set to controls.


Solution

  • It sounds like you're describing XML documentation comments. These will all show up in the intellisense tooltips:

    /// <summary>
    /// Documentation that describes the interface goes here.
    /// </summary>
    /// <remarks>
    /// Details about the interface go here.
    /// </remarks>
    interface TestInterface
    {
        /// <summary>
        /// Documentation that describes the method goes here.
        /// </summary>
        /// <param name="n">
        /// Parameter n requires an integer argument.
        /// </param>
        /// <returns>
        /// The method returns an integer.
        /// </returns>
        int InterfaceMethod(int n);
    }