C# code convention

  • Thread starter Thread starter Bala
  • Start date Start date
B

Bala

Hi there,

I was wondering if someone could provide me with a C# code convention
document. I've tried to find some using "Google", but to no avail. I
did find plenty of Java Code conventions, which is pretty useful for C#
too, but I would really like a "dedicated" C# convention.

Thanks in advance,

Alke Wiebenga
 
Bala,
I was wondering if someone could provide me with a C# code convention
document. I've tried to find some using "Google", but to no avail. I
did find plenty of Java Code conventions, which is pretty useful for C#
too, but I would really like a "dedicated" C# convention.

I think I understand what you are talking about I can recommend a good book:

Practical Guidelines and Best Practices for Microsoft Visual Basic and
Visual C# Developers

It is slightly out of date but it does the job and I refer to it often.
It is published by Microsoft.

Regards,

Richard
 
I was wondering if someone could provide me with a C# code convention
document. I've tried to find some using "Google", but to no avail. I
did find plenty of Java Code conventions, which is pretty useful for C#
too, but I would really like a "dedicated" C# convention.

Here's another one:

http://www.idesign.net/idesign/download/IDesign CSharp Coding Standard.zip

Not one I can really recommend though, since last time I looked it
there were too many things I didn't agree with. But I guess just
having a standard, good or bad, is better than not having one at all.


Mattias
 
Mattias Sjögren said:
Not one I can really recommend though, since last time I looked it
there were too many things I didn't agree with. But I guess just
having a standard, good or bad, is better than not having one at all.

No, having a bad standard is bad - period. What's better than not having one
at all is having one that's not perfect (or that everyone agrees with).

///ark
 
Hi,

Thanks for the prompt responses!!!
I've got everything I need!

Thanks and bye now!

Alke Wiebenga
 
Take a look at this book:

The Elements of C# Style (Paperback)
by Kenneth Baldwin, Andrew Gray, Trevor Misfeldt

Hope this helps.
 
No, having a bad standard is bad - period. What's better than not having one
at all is having one that's not perfect (or that everyone agrees with).

Firstly, let me say that I think coding standards are a Very Good
Thing Indeed. But who defines what is a bad standard? One that enough
people disagree with? Nobody will ever agree on "correct" coding
standards, in the end it is a matter of personal preference. Mostly
though, I tend to agree with the majority of the standards that I have
read. Even where they conflict, heh.

As far as code *layout* is concerned (as apart from standards, and
this really is a matter of personal preference), one reason I am
migrating from C++ to C# is because I prefer to write:

if (condition)
{
stuff;
}

rather than the (IMO) ghastly:

if (condition) {
stuff;
}

Oh, and I hate:

if { (condition ) }
{
stuff;
}

too.

Well, we all have our little foibles...
 
Back
Top