28223 cazuri COVID-19 în Moldova
7626 – cazuri active
19740 – cazuri vindecate
857 – cazuri fatale
Actualizarea datelor: 12 august 2020 ora 08:27


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

22:29:44Distracție ciudată în jungla urbană —» Curaj.TV | Media alternativă
22:09:59DESPRE GLAMOUR ŞI VINĂRII —» Curaj.TV | Media alternativă
20:43:09Înscrieri la webinarul “Vampirii energetici. Cum ne protejăm de oamenii toxici” —» Sanda Diviricean – "Fii-Nu încerca să devii." – Osho
19:04:29Râsuri prezidențiabile —» Sergiu Mocanu
18:48:17ЧТО НАТВОРИЛ ДАРВИН: Кровавое наследие теории эволюции —» Curbet Alexandru
16:12:21Un ”7 aprilie” în Belarus?! Va cădea dictatura lui Lukașenko? —» Elena Robu
10:06:21„Cartea Nicoletei” la Centrul Academic Internațional Eminescu —» BiblioCity
09:10:03Cheia succesului—un parteneriat viabil —» Mişcarea Ecologistă din Ştefan-Vodă
09:06:24Как любимый автомобиль, превращается в кирпич, через 450 км? AdBlue Error —» Сажевые фильтры (DPF/ FAP). Чип тюнинг. Теория, практика.
07:38:20Au prins poliția cu un transport de lemne —» Curaj.TV | Media alternativă
07:29:24Candidata opoziției, Svetlana Tihanovski a părăsit Belarusul —» Elena Robu
07:09:36COVID-19: Peste 20 de milioane de infectări la nivel global —» Elena Robu
07:06:51Tu cui dai energia ta pozitivă? —» Sunt MAMĂ!
00:26:38Despre atașare și siguranță în relații —» Viata pe Tinder – Viata amoroasa pe Tinder
20:10:41Condiții inumane la închisoarea de la Tighina/Bender —» Curaj.TV | Media alternativă
18:59:00Putin, Lukașenko și Dodon : Când votul poporului nu contează —» Elena Robu
14:44:2132/40: „Bucuria Ordinii” de Marie Kondo —» Sunt MAMĂ!
13:03:33Se caută persoane înșelate de Albina Ciorbă! —» un alt blog
12:45:11Au adus un elefant roz la DIICOT, semaforul era galben —» Curaj.TV | Media alternativă
11:11:52Zbor poetic —» Reflectii
10:58:24Proteste violente în Belarus după alegerile prezidențiale de duminică: Cel puțin o persoană a decedat —» Elena Robu
09:25:20Отзыв клиента после чиптюнинга BMW 520d G30 —» Сажевые фильтры (DPF/ FAP). Чип тюнинг. Теория, практика.
08:45:57Наславча —» XStrafer's WebPlace : unconformable point of view.
08:41:53Condițiile de intrare pe teritoriul Italiei, aplicate din data de 10 august până la data de 7 septembrie 2020 —» Elena Robu
07:30:16Digitizare, digitalizare și transformare digitală: diferențe —» Blog de biblioteconomie şi ştiinţa informării