
Chapter 2: Learning Just Enough C# or VB.NET: Basic Syntax | 53 |
VB
C#
.NET
Description
Byte | byte | Byte | |
|
|
|
|
SByte | sbyte | SByte | |
|
|
|
|
Short | short | Int16 | |
|
|
|
|
UInt16 | ushort | UInt16 | |
|
|
|
|
Integer | int | Int32 | |
UInt32 | uint | UInt32 | |
|
|
|
|
Long | long | Int64 | |
|
|
|
|
UInt64 | ulong | UInt64 | |
|
|
|
|
Single | float | Single | |
|
|
|
|
Double | double | Double | |
|
|
|
|
Boolean | bool | Boolean | true or false |
Char | Char | Char | |
|
|
|
|
Decimal | decimal | Decimal | |
|
|
|
|
String | string | String | String of Unicode characters |
|
|
|
|
Table 2-2 Primitive Types
learn how to create custom types later. First, you need to learn about primitive types. The primitive types are part of the programming languages and built into .NET. A primitive type is the most basic type of data that you can work with in .NET, which can’t be broken into smaller pieces. In contrast, a custom type can be made up of one or more primitive types, such as a Customer type that would have a name, an address, and possibly more bits of data that are primitive types. Table
Looking at Table
C#:
int age1; Int32 age2;
VB:
Dim age1 as Integer Dim age2 as Int32