Aug 3 2007

Coding standards - String vs string etc

Category: .NetRory Primrose @ 06:09

I recently posted about some coding standards I have been reviewing. There is another standard that has plagued me where my research doesn't really offer any solid guidance.

It is the old argument of:

  • string vs String
  • bool vs Boolean
  • int vs Int32
  • long vs Int64

The reason I like the String/Boolean option is because the colour coding in the IDE clearly identifies the text as a type rather than a C# keyword. That being said, I still tend to use int and long, but then revert to String and Boolean. One reason that Int32/Int64 is better would be that the meaning of int/long may change with the platform (I think this is right, someone please confirm) whereas Int32 and Int64 have static meanings.

Any thoughts?

Tags:

Comments (1) -

1.
Brett Maytom Brett Maytom says:

Rory,

From the articles, documents I have read the C# alias implementations will remain for all versions.  Should they change in each platform (as with C), the design objective of the platform would be broken.

As for int vs Int32, my feeling is that it is a personal choice and decided by each team.  The important decision is that the entire team is consistant.

As my choice, I am a lazy typist (even with intellisense), so I prefer int.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading