C# Online.NET Visual C# Developer Center
Search

C# Compared—Data Type Differences

Visual C# Tutorials
C# Tutorials

C# Compared to Other Languages

© 2005 C. Gunnerson, et al.

Data Type Differences

In Visual Basic, the integer data types are Integer and Long. In C#, these are replaced with the types short and int. There is a long type as well, but it is a 64-bit (8-byte) type. This is something to keep in mind, because if long is used in C# where Long would have been used in VB, programs will be bigger and much slower. Byte, however, is merely renamed to byte.

C# also has the unsigned data types ushort, uint, and ulong, and the signed byte sbyte. These are useful in some situations, but they can’t be used by all other languages in .NET, so they should only be used as necessary.

The floating point types Single and Double are renamed float and double, and the Boolean type is known simply as bool.


Previous_Page_.gif Next_Page_.gif