![Page 1: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/1.jpg)
C# : introduction
Achref El Mouelhi
Docteur de l’universite d’Aix-MarseilleChercheur en programmation par contrainte (IA)
Ingenieur en genie logiciel
H & H: Research and Training 1 / 28
![Page 2: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/2.jpg)
Plan
1 Introduction
2 Installation
3 Un premier Hello world
4 Aspect multi-langages du Framework .NET
5 Afficher un message dans la console
6 Commentaires
7 Console
8 Reference
H & H: Research and Training 2 / 28
![Page 3: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/3.jpg)
© Achref EL MOUELHI ©
Introduction
C#
C#
un langage de programmation oriente objet, fortement type
cree par Anders Hejlsberg et presente officiellement en 2002 parMicroSoft
permettant de developper des applications qui s’executent sur leframework MicroSoft .NET.
introduit pour concurrencer Java : syntaxe et concept assezproches.
permettant de developper des applications web, application dubureau (Client lourd), application mobiles (sous windows phone),web services, jeux...
H & H: Research and Training 3 / 28
![Page 4: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/4.jpg)
© Achref EL MOUELHI ©
Introduction
C#
Comment ca fonctionne ?
On ecrit un programme C#
Le code C# sera transforme en un langage intermediaire (appeleCIL pour Common Intermediate Language ou MSIL pour MicrosoftIntermediate Language) : un fichier .exe sans code binaire
Le code CIL sera compile par la machine virtuelle CLR pour avoirun code binaire.
code C#
compilercode en langage
intermdiaire (CIL)
Common LanguageRuntime (CLR)
code binaire
H & H: Research and Training 4 / 28
![Page 5: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/5.jpg)
© Achref EL MOUELHI ©
Introduction
C#
Comment ca fonctionne ?
On ecrit un programme C#
Le code C# sera transforme en un langage intermediaire (appeleCIL pour Common Intermediate Language ou MSIL pour MicrosoftIntermediate Language) : un fichier .exe sans code binaire
Le code CIL sera compile par la machine virtuelle CLR pour avoirun code binaire.
code C#
compilercode en langage
intermdiaire (CIL)
Common LanguageRuntime (CLR)
code binaire
H & H: Research and Training 4 / 28
![Page 6: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/6.jpg)
© Achref EL MOUELHI ©
Introduction
C#
code CIL vs code binaire
CIL : un code intermediaire qu’on peut executer sur n’importequelle machine Windows.
code binaire : adapte a la machine sur laquelle il tourne.
code C#
compilercode en langage
intermdiaire (CIL)
Common LanguageRuntime (CLR)
code binaire
H & H: Research and Training 5 / 28
![Page 7: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/7.jpg)
© Achref EL MOUELHI ©
Introduction
C#
En plus, la machine virtuelle (CLR) dispose de :
JIT (Just In Time) : pour debugger
Garbage Collector : pour gerer la memoire
CTS (Common Type System) : fournit une bibliotheque contenantles types de donnees primitif
CLS (Common Language Specification) : pour verifier qu’unprogramme respecte les specifications .NET
...
H & H: Research and Training 6 / 28
![Page 8: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/8.jpg)
© Achref EL MOUELHI ©
Introduction
C#
Dans un framework .NET
On peut ecrire un code C#, et aussi VB, C++, F#.
Tous ces langages seront compiles en code CIL
.cpp
.cs
.fs
.vb
CIL
H & H: Research and Training 7 / 28
![Page 9: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/9.jpg)
© Achref EL MOUELHI ©
Introduction
C#
A partir d’un programme C#, il est possible
soit de creer des programmes .exe
soit de creer des bibliotheques sous la forme d’un fichier .dll
C’est quoi la difference?
.exe permet de lancer un programme
.dll peut etre utilisee par plusieurs programmes .exe
Dans les deux cas
On parle d’un assembly
H & H: Research and Training 8 / 28
![Page 10: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/10.jpg)
© Achref EL MOUELHI ©
Introduction
C#
A partir d’un programme C#, il est possible
soit de creer des programmes .exe
soit de creer des bibliotheques sous la forme d’un fichier .dll
C’est quoi la difference ?
.exe permet de lancer un programme
.dll peut etre utilisee par plusieurs programmes .exe
Dans les deux cas
On parle d’un assembly
H & H: Research and Training 8 / 28
![Page 11: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/11.jpg)
© Achref EL MOUELHI ©
Introduction
C#
A partir d’un programme C#, il est possible
soit de creer des programmes .exe
soit de creer des bibliotheques sous la forme d’un fichier .dll
C’est quoi la difference ?
.exe permet de lancer un programme
.dll peut etre utilisee par plusieurs programmes .exe
Dans les deux cas
On parle d’un assembly
H & H: Research and Training 8 / 28
![Page 12: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/12.jpg)
© Achref EL MOUELHI ©
Introduction
C#
Et le framework .NET?
Framework cree par Microsoft en 2002, en meme temps que leC#, et aussi par la meme personne
Permettant de developper des programmes (applications)fonctionnant dans un environnement Microsoft.
Plusieurs langages possibles : C#, C++, F#...
Exemple
Paint.net : l’editeur d’images est realise avec le framework .NET
H & H: Research and Training 9 / 28
![Page 13: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/13.jpg)
© Achref EL MOUELHI ©
Introduction
C#
Et le framework .NET?
Framework cree par Microsoft en 2002, en meme temps que leC#, et aussi par la meme personne
Permettant de developper des programmes (applications)fonctionnant dans un environnement Microsoft.
Plusieurs langages possibles : C#, C++, F#...
Exemple
Paint.net : l’editeur d’images est realise avec le framework .NET
H & H: Research and Training 9 / 28
![Page 14: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/14.jpg)
© Achref EL MOUELHI ©
Introduction
C#
Le .NET est compatible seulement avec Windows
Pour ecrire des programmes C# sous Linux ou MAC, on peut utiliser
le framework mono
le framework Xamarin
Visual Studio?
Un IDE (Integrated Development Environment) qui nous permetd’ecrire des programmes avec le framework .NET
H & H: Research and Training 10 / 28
![Page 15: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/15.jpg)
© Achref EL MOUELHI ©
Introduction
C#
Le .NET est compatible seulement avec Windows
Pour ecrire des programmes C# sous Linux ou MAC, on peut utiliser
le framework mono
le framework Xamarin
Visual Studio?
Un IDE (Integrated Development Environment) qui nous permetd’ecrire des programmes avec le framework .NET
H & H: Research and Training 10 / 28
![Page 16: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/16.jpg)
© Achref EL MOUELHI ©
Installation
C#
Telechargement et installation
Aller sur le lienhttps://www.visualstudio.com/fr/downloads/
Choisir la version communaute Visual Studio Community2019
Telecharger puis lancer l’installation
H & H: Research and Training 11 / 28
![Page 17: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/17.jpg)
© Achref EL MOUELHI ©
Un premier Hello world
C#
Etapes
Creer un nouveau projet Fichier > Nouveau > Projet
Cliquer sur Installe et choisir C#
Dans Windows Desktop, selectionner Application console(.NET Framework)
Remplir les champs
Nom : avec MonProjet
Solution avec MaSolution
Dans Emplacement, Visual Studio nous informe sur le depot ou notreprojet sera place. Par defaut, c’est dans lec:/utilisateurs/utilisateur/source/repos.
H & H: Research and Training 12 / 28
![Page 18: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/18.jpg)
© Achref EL MOUELHI ©
Un premier Hello world
C#
Code obtenu
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;
namespace MonProjet{
class Program{
static void Main(string[] args){}
}}
Syntaxe et concept assez proches de celles de C++ et Java.H & H: Research and Training 13 / 28
![Page 19: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/19.jpg)
© Achref EL MOUELHI ©
Un premier Hello world
C#
Explication
On utilise Using pour importer les namespaces (comme en C++)
Le namespace permet de declarer un nouveau namespace(comme un package Java)
static void Main() : point d’entree de notre applicationconsole
H & H: Research and Training 14 / 28
![Page 20: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/20.jpg)
© Achref EL MOUELHI ©
Un premier Hello world
Afficher le Hello world!
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;
namespace MonProjet{
class Program{
static void Main(string[] args){
Console.Write("Hello world");}
}}
Executer en cliquant sur Demarrer (ou CTRL + F5, ou [fn +] CTRL + F5 ).
H & H: Research and Training 15 / 28
![Page 21: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/21.jpg)
© Achref EL MOUELHI ©
Un premier Hello world
Afficher le Hello world!
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;
namespace MonProjet{
class Program{
static void Main(string[] args){
Console.Write("Hello world");}
}}
Executer en cliquant sur Demarrer (ou CTRL + F5, ou [fn +] CTRL + F5 ).
H & H: Research and Training 15 / 28
![Page 22: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/22.jpg)
© Achref EL MOUELHI ©
Un premier Hello world
C#Si la console se ferme avant de voir le Hello world.
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;
namespace MonProjet{
class Program{
static void Main(string[] args){
Console.Write("Hello world");Console.ReadKey();
}}
}
H & H: Research and Training 16 / 28
![Page 23: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/23.jpg)
© Achref EL MOUELHI ©
Un premier Hello world
C#
Constat
Le titre de la console contient indique l’emplacement de l’executablec:/utilisateurs/utilisateur/source/repos/MaSolution/MonProjet/bin/Debug/MonProjet.exe
Pour acceder rapidement aux fichiers de notre projet
Aller dans le menu Affichage et cliquer sur Explorateur desolutions
Un clic droit sur MaSolution qui apparaıt dans le panneauExplorateur de solutions et choisir Ouvrir le dossierdans l’Explorateur de fichiers
H & H: Research and Training 17 / 28
![Page 24: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/24.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#
Objectif
Ecrire une solution .NET avec plusieurs langages de programmation.
H & H: Research and Training 18 / 28
![Page 25: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/25.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#
Etape 1 : creer un projet VB appartenant a MaSolution
Aller Fichier > Nouveau > Projet
Choisir Visual Basic
Selectionner Bibliotheque de classes (.NETFramework)
Saisir MonVB dans Nom
Dans Solution :, choisir Ajouter a la solution
Choisir MaSolution et valider
Verifier la presence de deux projets dans l’Explorateur desolutions
H & H: Research and Training 19 / 28
![Page 26: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/26.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#
Code obtenu
Public Class Class1
End Class
Etape 2, modifions le code precedent
Public Class ClassVBSub SayHello()
Console.WriteLine("Message VB")End Sub
End Class
Si on verifie le repertoire bin/Debug de ce projet VB, on verra qu’ilest vide (pas d’executable), donc inexploitable.
H & H: Research and Training 20 / 28
![Page 27: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/27.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#
Code obtenu
Public Class Class1
End Class
Etape 2, modifions le code precedent
Public Class ClassVBSub SayHello()
Console.WriteLine("Message VB")End Sub
End Class
Si on verifie le repertoire bin/Debug de ce projet VB, on verra qu’ilest vide (pas d’executable), donc inexploitable.
H & H: Research and Training 20 / 28
![Page 28: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/28.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#
Etape 3 : generer l’executable
Aller dans l’Explorateur de solution
Faire un clic droit sur le projet MonVB
Choisir Generer
Si on verifie le repertoire bin/Debug, trois fichiers ont ete generesdont un .dll
H & H: Research and Training 21 / 28
![Page 29: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/29.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#
Etape 3 : generer l’executable
Aller dans l’Explorateur de solution
Faire un clic droit sur le projet MonVB
Choisir Generer
Si on verifie le repertoire bin/Debug, trois fichiers ont ete generesdont un .dll
H & H: Research and Training 21 / 28
![Page 30: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/30.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#
Etape 4 : connecter les deux projets
Aller dans l’Explorateur de solution
Dans le projet MonProjet, Faire un clic droit sur References etchoisir Ajouter une reference
Cliquer sur Projets et cocher la case MonVB
Valider
Verifier que MonVB figure dans la liste de references de MonProjet
H & H: Research and Training 22 / 28
![Page 31: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/31.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#
Etape 4 : connecter les deux projets
Aller dans l’Explorateur de solution
Dans le projet MonProjet, Faire un clic droit sur References etchoisir Ajouter une reference
Cliquer sur Projets et cocher la case MonVB
Valider
Verifier que MonVB figure dans la liste de references de MonProjet
H & H: Research and Training 22 / 28
![Page 32: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/32.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#Etape 5 : utilisons la classe ClassVB ecrite en Visual Basic dans C#
using System;using MonVB;
namespace MonProjet{
class Program{
static void Main(string[] args){
ClassVB c = new ClassVB();c.SayHello();Console.Write("hello world");Console.ReadKey();
}}
}
H & H: Research and Training 23 / 28
![Page 33: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/33.jpg)
© Achref EL MOUELHI ©
Aspect multi-langages du Framework .NET
C#
Executer : le resultat est
Message VBHello world
H & H: Research and Training 24 / 28
![Page 34: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/34.jpg)
© Achref EL MOUELHI ©
Afficher un message dans la console
C#
Pour ecrire dans la console
Console.WriteLine("Un message et un retour a laligne");
Pour ecrire sans retourner a la ligne
Console.Write("Un message sans retour a la ligne");
H & H: Research and Training 25 / 28
![Page 35: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/35.jpg)
© Achref EL MOUELHI ©
Commentaires
C#
Commentaire sur une seule ligne
// commentaire
Commentaire sur une plusieurs lignes
/* le commentairela suiteet encore la suite
*/
Commentaire pour la documentation
/// un commentaire qui sera inclu dans ladocumentation
H & H: Research and Training 26 / 28
![Page 36: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/36.jpg)
© Achref EL MOUELHI ©
Commentaires
C#
Commentaire sur une seule ligne
// commentaire
Commentaire sur une plusieurs lignes
/* le commentairela suiteet encore la suite
*/
Commentaire pour la documentation
/// un commentaire qui sera inclu dans ladocumentation
H & H: Research and Training 26 / 28
![Page 37: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/37.jpg)
© Achref EL MOUELHI ©
Commentaires
C#
Commentaire sur une seule ligne
// commentaire
Commentaire sur une plusieurs lignes
/* le commentairela suiteet encore la suite
*/
Commentaire pour la documentation
/// un commentaire qui sera inclu dans ladocumentation
H & H: Research and Training 26 / 28
![Page 38: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/38.jpg)
© Achref EL MOUELHI ©
Console
C#
Modifier la console
Console.BackgroundColor = ConsoleColor.Red; pourmettre la couleur de fond en rouge
Console.ForegroundColor = ConsoleColor.Yellow;pour mettre la couleur de caracteres en jaune
Console.ResetColor(); pour reinitialiser les couleurs
Console.Clear(); pour effacer le contenu de la console
Console.SetCursorPosition(50, 50); pour positionnerla console
...
H & H: Research and Training 27 / 28
![Page 39: C# : introduction · 2020-02-01 · Introduction C# C# un langage de programmation oriente objet, fortement typ´ e´ cre´e par Anders Hejlsberg et pr´ esent´ e officiellement](https://reader034.vdocument.in/reader034/viewer/2022043004/5f875bb8044250036f3dd403/html5/thumbnails/39.jpg)
© Achref EL MOUELHI ©
Reference
C#
La documentation officielle (en francais)
https://docs.microsoft.com/fr-fr/dotnet/csharp/index
H & H: Research and Training 28 / 28