none
Capital letters in data types

    Question

  • Hi to all!

    Just a maybe simple and small question. Does anybody could explain me what is the difference between capital letter and small letter at the beginning of a datatype??

    I mean what is the diferrence between:

    Double (with big D) and double (with small d)?

    Both works when declaring a variable but what is behind this?

    Thanks a lot in advance!

     

    Thursday, November 16, 2006 9:43 AM

Answers

  • The type names that start with a capital letter are .NET base class library type names. To use them you either have to import the System namespace (with a using System; statement) or fully qualify them (e.g. System.Double).

    The lower case type names are C# keywords. They work in any context regardless of namespace imports and can be seen as aliases for the BCL type names.

    Note that while the the names are sometimes the same (string/String, double/Double) they can also be slightly different (int/Int32, ulong/UInt64, bool/Boolean) so it's not just a difference in case. But the end result in the compiled code is the same so you can pretty much choose the name you prefer.

     

    Thursday, November 16, 2006 10:02 AM
  • Thanks a lot for the useful information! :-))
    Thursday, November 16, 2006 10:11 AM

All replies

  • The type names that start with a capital letter are .NET base class library type names. To use them you either have to import the System namespace (with a using System; statement) or fully qualify them (e.g. System.Double).

    The lower case type names are C# keywords. They work in any context regardless of namespace imports and can be seen as aliases for the BCL type names.

    Note that while the the names are sometimes the same (string/String, double/Double) they can also be slightly different (int/Int32, ulong/UInt64, bool/Boolean) so it's not just a difference in case. But the end result in the compiled code is the same so you can pretty much choose the name you prefer.

     

    Thursday, November 16, 2006 10:02 AM
  • Thanks a lot for the useful information! :-))
    Thursday, November 16, 2006 10:11 AM