Lecture overview -- Keyboard shortcut: 'u'  Previous page: The Overall Picture -- Keyboard shortcut: 'p'  Next page: Declaration and Types -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 26 : 43
Object-oriented Programming in C#
Introduction to C#
Declarations and Types

Option Strict On
Option Explicit On

Module DeclarationsDemo

    Sub Main()
        Dim ch As Char = "A"C     ' A character variable
        Dim b As Boolean = True   ' A boolean variable
        Dim i As Integer = 5      ' An integer variable (4 bytes)
        Dim s As Single = 5.5F    ' A floating point number (4 bytes)
        Dim d As Double = 5.5     ' A floating point number (8 bytes)
    End Sub

End Module

A Visual Basic Program with a number of variable declarations.

using System;

class DeclarationsDemo{

  public static void Main(){
    char ch = 'A';          // A character variable
    bool b = true;          // A boolean variable
    int i = 5;              // An integer variable (4 byges)
    float s = 5.5F;         // A floating point number (4 bytes)
    double d = 5.5 ;        // A floating point number (8 bytes) 
  }

}

The similar C# program with a number of variable declarations.