Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Any suggestions on how to comment the top of a C# class file?

Posted on 2012-03-28
5
Medium Priority
?
344 Views
Last Modified: 2012-04-03
Are there any standard practices for adding comments to the top of a C# file? For example, I would imagine that it should include something like the author and date.

I need to submit a C# code file to a potential employer and I'd like to know if their is anything that is considered good practice when labeling a class?
0
Comment
Question by:Eindoofus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:tony_techtoneic
ID: 37779992
0
 

Author Comment

by:Eindoofus
ID: 37780004
That seems a bit bloated. I was just hoping for some simple comments that show up in XML for the author and date that I can add to the top before all of my "using" statements.
0
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 2000 total points
ID: 37780093
Hi Eindoofus,

Something like this?
// <copyright file="AssemblyInfo.cs" company="FullStack"> 
// Copyright (c) 2008 All Right Reserved 
// </copyright> 
// <author>Rhys Campbell</author> 
// <email>rhysc@fullstack.co.uk</email> 
// <date>2008-09-10</date> 
// <summary>Contains assembly information.</summary>

Open in new window


Link : http://rhysc.blogspot.in/2008/09/style-cop-and-vs-defaults.html

Regards,
Chinmay.
0
 

Author Comment

by:Eindoofus
ID: 37780154
Thanks. Once last thing, should it be three slashes rather than two? I always thought it was the norm to put /// before XML tags in C#.
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 37780554
XML tags always have ///
and normal code comments can have //

These are not XML comments as such, these are as per the guidelines of StyleCop[http://stylecop.codeplex.com]

You can also use
 - StyleCop
 - FxCop[codeplex] OR Code Analysis [built into Visual Studio for Ultimate Edition - not sure about others]
 - Code Metrics [built into Visual Studio]

This will help you a lot to improve your code.

Regards,
Chinmay.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question