Add Description to Method's parameters

Jassim Al Rahma 1,516 Reputation points
2022-09-19T11:54:00.067+00:00

Hi,

I have this method:

public static string Encrypt(string text, string key)  

How can I create a description for the two parameters so user will be able to see in VS when using this method?

Thanks,
Jassim

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,097 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jack J Jun 24,276 Reputation points Microsoft Vendor
    2022-10-05T07:32:56.827+00:00

    @Jassim Al Rahma . thanks for the feedback, based on my test, I reproduced your problem.

    I find that we need to do some special settings when we use c# documentation in other projects.

    First, We could edit your TempMAUIClass.csproj to add the following tag in your propertygroup:

    <PropertyGroup>  
      
                      <GenerateDocumentationFile>true</GenerateDocumentationFile>-> add it  
    </PropertyGroup>  
    

    Second, Please rebuild your project and check if you have the xml file in your output folder.

    Third, Please Repeat steps one and two above for your project TempMAUIAppUsingClass.

    Finally, you could see the comment in the TempMAUIAppUsingClass project:

    247588-image.png

    Best Regards,
    Jack


    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Karen Payne MVP 35,016 Reputation points
    2022-09-19T12:16:00.347+00:00

    Add xml documentation

    public class Utilities  
    {  
        /// <summary>  
        /// TODO  
        /// </summary>  
        /// <param name="text">TODO</param>  
        /// <param name="key">TODO</param>  
        /// <returns>TODO</returns>  
        public static string Encrypt(string text, string key)  
        {  
            ...  
        }  
    }  
    

    See Usage

    242485-f2.png

    Code

    1 person found this answer helpful.

  2. Karen Payne MVP 35,016 Reputation points
    2022-09-20T10:31:02.217+00:00

    Here is another example, code for video is here.

    242947-intellisense.gif

    1 person found this answer helpful.