csharp
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| csharp [2016/08/12 19:45] – simon | csharp [Date inconnue] (Version actuelle) – supprimée - modification externe (Date inconnue) 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== C# ====== | ||
| - | Le C# est un langage de programmation de Microsoft. Les détails sont sur la [[https:// | ||
| - | ==== Installation de Mono ==== | ||
| - | |||
| - | ==== Hello World ==== | ||
| - | On crée un fichier '' | ||
| - | <code bash> | ||
| - | $ vim hello-world.cs | ||
| - | </ | ||
| - | <code csharp> | ||
| - | using System; | ||
| - | |||
| - | public class HelloWorld | ||
| - | { | ||
| - | static public void Main () | ||
| - | { | ||
| - | Console.WriteLine(" | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | On peut compiler ce tout petit programme avec la commande [[mcs]] : | ||
| - | <code bash> | ||
| - | $ mcs hello-world.cs | ||
| - | </ | ||
| - | |||
| - | On crée en ce faisant un fichier '' | ||
| - | <code bash> | ||
| - | $ ls | ||
| - | hello-world.cs | ||
| - | </ | ||
| - | |||
| - | On peut enfin lancer notre programme avec [[Mono]] : | ||
| - | <code bash> | ||
| - | $ mono hello-world.exe | ||
| - | Hello Mono World | ||
| - | </ | ||
| - | |||
| - | ==== Hello World sur Winform ==== | ||
| - | |||
| - | <code bash> | ||
| - | $ vim hello-winforms.cs | ||
| - | </ | ||
| - | <code csharp> | ||
| - | using System; | ||
| - | using System.Windows.Forms; | ||
| - | |||
| - | public class HelloWorld : Form | ||
| - | { | ||
| - | static public void Main () | ||
| - | { | ||
| - | Application.Run (new HelloWorld ()); | ||
| - | } | ||
| - | |||
| - | public HelloWorld () | ||
| - | { | ||
| - | Text = "Hello Mono World"; | ||
| - | } | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | On compile : | ||
| - | <code bash> | ||
| - | $ mcs hello-winforms.cs -pkg:dotnet -lib:/ | ||
| - | $ ls | ||
| - | hello-winforms.cs | ||
| - | $ mono hello-winforms.exe | ||
| - | </ | ||
| - | |||
| - | |||
| - | |||
| - | ==== Sources ==== | ||
| - | [[http:// | ||
csharp.1471031112.txt.gz · Dernière modification : (modification externe)
