About best coding Style of C#

  • Thread starter Thread starter kiplring
  • Start date Start date
And some feel it is even more silly to not initialize such data. From a
managers perspective you don't know who is going to maintain that code
several years down the road when a whole new set of languages is being used
and those people may not know a thing about C#. Many perspectives can be
valid. What Albert wrote many years ago is still true, "It is all relative".

Well, in this particular case there still is a way to kill both hares.
Add comments to the lines of code which can be mistreated later. And don't
hand it to people who "don't know a thing" in the first place.
 
Well, in this particular case there still is a way to kill both hares.

That's a new metaphor on me. :)
Add comments to the lines of code which can be mistreated later. And don't
hand it to people who "don't know a thing" in the first place.

Actually, I've seen such comments:

class Foo { bool a; // will be false }

I'd rather just write an executable comment:

class Foo { bool a = false; }

But I'd prefer just to assume that most people are at least as smart as me,
so I'd simply write

class Foo { bool a; }
 
Mark said:
That's a new metaphor on me. :)

Ah, that's literal translation from my native language. I know,
translating idioms is not what you should normally do, but I was lazy
to look for an English equivalent.
Actually, I've seen such comments:

class Foo { bool a; // will be false }

I'd rather just write an executable comment:

class Foo { bool a = false; }

But I'd prefer just to assume that most people are at least as smart as me,
so I'd simply write

class Foo { bool a; }

Unfortunately, we are not in ideal world, and I can understand people
who have concerns about it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top