Professional Documents
Culture Documents
Chapter 2:
C# Basic
Agenda
Memulai C#
Language Style
Kompilasi
Struktur Program C#
Namespace
Variable
Basic I/O
Demo
Memulai C#
Baca: C-Sharp! Bukan C-Cresc
Language Style
Syntax based on C/C++
Case-sensitive
White space means nothing
Semicolons (;) to terminate statements
Code blocks use curly braces ({})
Object oriented, code is structured using
the class keyword
Kompilasi
Compiler terpisah dengan IDE Visual Studio
.NET
Auto Compiled dengan Visual Studio.NET
Manual Compilation dengan csc.exe
(CSharp Compiler)
Struktur Program C#
Namespaces
Type declarations
Members
Main Method
Namespace
Access Namespace
Using
Variabel
Tempat penyimpanan data sementara di
memori
Single Declaration :
string strNama;
Multiple Declaration :
int intUmur, intJumlah;
Variable Scope
Namespace / Class Level Variable
Procedure Level Variable
Block Level Variable
Namespace
Module
Procedure
Block
Komentar pada C#
Bagian comment tidak akan disertakan dalam
proses kompilasi.
Komentar pada 1 baris
Menggunakan simbol //
/*int a = 10;
a = a + 2; */
Basic I/O
Input
Output
Komentar pada C#
Demo:
Membuat Program C# pertama
dengan Notepad dan CSC