Re: CSharp Coding Standards
- From: "Brian Gideon" <briangideon@xxxxxxxxx>
- Date: 29 Mar 2007 09:27:25 -0700
On Mar 29, 5:44 am, aurat...@xxxxxxxxx wrote:
[snip]
Always have a default case in a switch statement that asserts:
int number = SomeMethod( );
switch(number)
{
case 1:
Trace.WriteLine("Case 1:");
break;
case 2:
Trace.WriteLine("Case 2:");
break;
default:
Debug.Assert(false);
break;
}
I like this pattern as well.
void Foo()
{
int number = SomeMethod();
switch (number)
{
case 1: /* blaa blaa */ return Something;
case 2: /* blaa blaa */ return SomethingElse;
}
return DefaultValue;
}
Do not use the this reference unless invoking another constructor from
within a constructor:
I care that much as long as the this keyword is used consistently or
not at all. Using it only half the time is pretty annoying.
Never call Thread.Join( ) without checking that you are not joining
your own thread:
That's too restriction. In fact, I can't think of situation where any
of my code could call Join on its own thread.
.
- Follow-Ups:
- Re: CSharp Coding Standards
- From: Brian Gideon
- Re: CSharp Coding Standards
- References:
- CSharp Coding Standards
- From: auratius
- CSharp Coding Standards
- Prev by Date: Re: c# algorithms / c# puzzles
- Next by Date: Re: FindReplaceDialog?
- Previous by thread: Re: CSharp Coding Standards
- Next by thread: Re: CSharp Coding Standards
- Index(es):
Relevant Pages
|