Skip to Content
C# 3.0: kurz & gut
book

C# 3.0: kurz & gut

by Joseph Albahari, Ben Albahari
May 2008
Intermediate to advanced content levelIntermediate to advanced
248 pages
3h 50m
German
O'Reilly Verlag
Content preview from C# 3.0: kurz & gut

Ein erstes C#-Programm

Dies ist ein Programm, das das Ergebnis von 12 × 30 ermittelt und das Ergebnis (360) ausgibt. Der doppelte Schrägstrich (Slash) gibt an, dass der Rest einer Zeile ein Kommentar ist.

class Test                      // Klassendeklaration
{
  static void Main(  )          //   Methodendeklaration
  {
    int x = 12 * 30;            //     Anweisung 1
    Console.WriteLine (x);      //     Anweisung 2
  }                             //   Ende der Methode
}                               // Ende der Klasse

Im Kern dieses Programms gibt es zwei Anweisungen. in C# werden sequenziell ausgeführt. Jede Anweisung wird durch ein Semikolon beendet:

int x = 12 * 30;
    Console.WriteLine (x);

Die erste Anweisung berechnet den Ausdruck 12 * 30 und speichert das Ergebnis in einer lokalen Variablen mit dem Namen x, die ganzzahlig ist. Die zweite Anweisung ruft die Methode

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

How I Built a Personal Board of Directors With GenAI

How I Built a Personal Board of Directors With GenAI

Vipin Gupta
How to Become a Game-Changing Leader

How to Become a Game-Changing Leader

Douglas A. Ready, Alan Mulally
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9783897215443