Skip to Main Content
C# 5.0. Leksykon kieszonkowy. Wydanie III
book

C# 5.0. Leksykon kieszonkowy. Wydanie III

by Joseph Albahari, Ben Albahari
September 2013
Intermediate to advanced content levelIntermediate to advanced
208 pages
5h 19m
Polish
Helion
Content preview from C# 5.0. Leksykon kieszonkowy. Wydanie III

Pierwszy program w C#

Oto program wyliczający iloczyn 12 razy 30 i wypisujący wynik (360) na konsoli. Podwójne znaki ukośników umieszczone w kodzie oznaczają, że reszta danego wiersza to komentarz do kodu:

using System;                   // Import przestrzeni nazw

class Test                      // Deklaracja klasy
{
  static void Main()            // Deklaracja metody w klasie
  {
    int x = 12 * 30;            // Instrukcja (1)
    Console.WriteLine (x);      // Instrukcja (2)
  }                             // Koniec metody
}                               // Koniec klasy

Sedno tego programu tkwi w dwóch instrukcjach. Instrukcje w języku C# są wykonywane sekwencyjnie (jedna po drugiej). Każda instrukcja kończy się znakiem średnika.

Pierwsza z tych instrukcji oblicza wartość wyrażenia 12 * 30 i zapisuje ustalony wynik w zmiennej lokalnej o nazwie x typu całkowitego. Druga instrukcja ...

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

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick

Publisher Resources

ISBN: 9781457178559