199 cazuri COVID-19 în Moldova
195 – cazuri active
2 – cazuri vindecate
2 – cazuri fatale
Actualizarea datelor: 28 martie 2020 ora 10:21


C# Basics

Now that you understand a little more about what C# can do, you will want to learn how to use it.
This chapter on the basics of C# will give you a good start in that direction by providing you with a basic knowledge of the fundamentals of C# programming, which we will build on in subsequent chapters. The main topics we will be covering are:
❑ Declaring variables
❑ Initialization and scope of variables
❑ Predefined C# data types
❑ Dictating the flow of execution within a C# program using loops and conditional
statements
❑ Enumerations
❑ Namespaces
❑ The Main() method
❑ Basic command line C# compiler options
❑ Using System.Console to perform console I/O
❑ Using documentation features in C# and Visual Studio .NET
❑ C# identifiers and keywords
❑ Recommended guidelines and conventions for good programming in C#.

By the end of this chapter you will know enough C# to write simple programs, though without using inheritance or other object-oriented features, which are covered in the following chapters.

Before We Start

As we have already mentioned, C# is an object-oriented language. As we get you up to speed in the fundamentals
of the C# language, we will be assuming that you have a good grasp of the concepts behind
object-oriented (OO) programming. In other words, we will expect you to understand what we mean
by classes, objects, interfaces, and inheritance. If you have programmed in C++ or Java before, you should
have a pretty good grounding in object-oriented programming (OOP). However, if you do not have a
background in OOP, there are plenty of good sources of information on this subject. You can start with
Appendix A, which presents a detailed introduction to OOP concepts and is posted at www.wrox.com.
We also recommend Beginning Visual C#, the revised edition of Beginning C# for .NET v1.0 (ISBN
0-7645-4382-2) which teaches both object-oriented programming and C# from scratch.
If you are an experienced developer in Visual Basic 6, C++, or Java, you should note that we will make
many comparisons between C#, C++, Java, and Visual Basic 6 as we walk you through the basics of C#.
However, you might prefer to learn C# initially by reading a comparison between C# and your selected
language. If so, we have also made available separate documents for download on the Wrox Press Web
site (www.wrox.com) that give introductions to C# from the point of view of each of those languages.

Our First C# Program
Let’s start in the traditional way by compiling and running the simplest possible C# program—a simple
class consisting of a console application that writes a message to the screen.

The Code
Type the following into a text editor (such as Notepad), and save it with a .cs extension (for example,
First.cs):
using System;
namespace Wrox.ProCSharp.Basics
{
class MyFirstCSharpClass
{
static void Main()
{
Console.WriteLine(“This isn’t at all like Java!”);
Console.ReadLine();
return;
}
}
}
The following chapters present a number of code samples. The most common technique for writing C#
programs is to use Visual Studio .NET to generate a basic project and add your own code to it. However,
since the aim of these early chapters is to teach the C# language, we are going to keep things simple and
avoid relying on Visual Studio .NET until Chapter 12. Instead, we will present the code as simple files
that you can type in using any text editor and compile from the command line.

Sursa
2007-07-14 20:04:00



Comenteaza





Ultimele 25 posturi adăugate

01:57:14LA découverte —» turn up the silence
21:02:44Spune ca la Mănăstire nu s-a auzit de coronavirus si se saruta icoanele —» Curaj.TV | Media alternativă
20:45:22(VIDEO) Francezii au ieșit la ferestre și i-au aplaudat pe medicii și asistentele care depun eforturi uriașe pentru combaterea coronavirusului —» Elena Robu
19:39:14COVID-19 pozitiv – este noul normal —» apostu
19:05:24La Peste —» turn up the silence
18:54:4027 martie – Ziua Mondială a Teatrului —» Biblioteca de Arte 'Tudor Arghezi'
18:28:06Hoții distrug pădurile în timp ce oamenii se ascund de COVID-19 —» Curaj.TV | Media alternativă
18:27:02©️ Când unii te rănesc, alții te vindecă… —» Licurici de suflet
17:04:41Coronavirus face ravagii în Italia: Aproape 1000 de morți în ultimele 24 de ore —» Elena Robu
16:56:19SĂ NU IEȘI DIN CASĂ... —» Leo Butnaru
15:25:38Primul medic care a decedat din cauza coronavirusului în R. Moldova —» Elena Robu
15:18:13n atenția organele locale de specialitate în domeniul învăţământului, instituţiilor de învăţământ general publice şi private, instituțiilor de învățământ profesional tehnic și instituțiilor de învățământ superior! —» Liceul Teoretic “Mihail Sadoveanu”, Călăraşi
14:56:0010 cei mai buni mijlocași centrali din ultimii 30 de ani. De ziua lui Gațcan —» Sandu GRECU
12:55:33Fostul deputat PDM Constantin Țuțu s-a predat benevol organelor de drept din Republica Moldova —» Elena Robu
10:39:56E nevăzător, dar a observat disperarea celor din Spania —» Curaj.TV | Media alternativă
09:27:12UN RĂU BINECUVÂNTAT. Suntem generația care are totul, dar n-are nimic —» Nicolae Federiuc
09:09:16Чип-тюнинг с доставкой! —» Сажевые фильтры (DPF/ FAP). Чип тюнинг. Теория, практика.
08:45:1412/40: „Te-am ales pe tine” de Mia Sheridan —» Sunt MAMĂ!
07:56:32Zdob și Zdub записали песню про коронавирус и призвали оставаться дома —» Заметки Начинающего Журналиста
07:06:35Şi ne iartă nouă greşelile noastre, precum şi noi iertăm greşiţilor noştri —» Portalul Tineretului Ortodox din Moldova
06:15:40Про дебилов и коронавирус —» Бессарабские хроники
04:43:56UN POET AVANGARDIST NĂSCUT LA ORHEI - DOVID KNUT —» Leo Butnaru
22:14:37Un deținut pe viață vrea să facă dezvăluiri presei —» Curaj.TV | Media alternativă
21:12:08Muzică și ploaie —» Păreri despre cei ce ne inconjoară
19:10:27Prețuiește fiecare moment —» Moldova Creștină