We usually create classes and methods in Visual Studio 2005 using C# or VB.Net. Once we have created a class and all of it's methods and properties, we can access the list of all of them in the intellisense when we use the class in our code. The intellisense feature automatically shows us the list of public methods and properties.
However, if we also want to add some comments to explain what each method does and what are the parameters etc. we can do that using XML comments.
To add XML comments just do the following:
C#: enter three forward slashes like this ///
VB.NET: enter three single quotes like this '''
This will authomatically add a template for you as shown below:
/// < *summary >
/// /// < / summary >
/// < *param name="Name">< / param >
/// < *param name="Password">< / param >
/// < *returns>< / returns >
You can fill in appropriate information in the template as shown below:
/// < *summary >
/// This is just a test method, to check intellisense comments
/// < / summary >
/// < *param name="Name">The name of the user as string < / param >
/// < *param name="Password">The password of the user as string< / param >
/// < *returns >true if valid, flase if invalid < / returns >
public static bool TestMethod(string Name, string Password)
{
return true;
}
Now, when you'll access the method TestMethod(), you'll also see the comments in the intellisense.
Note: I have added extra spaces and a star in the xml tags otherwise blogger will block that part of the code, so you can remove the spaces and stars while using the code.
1 comment:
Dear Sir,
I have a launched new web site for .NET programming resources. www.codegain.com. I would like to invite to the codegain.com as author and supporter. I hope you will joins with us soon.
Thank You
RRaveen
Founder www.codegain.com
Post a Comment