No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Visual studio

La séquence animée suivante nous montre comment réaliser un petit programme en mode console.

Pour cet exemple, nous allons récupérer les valeurs de l'énumération qui contient les couleurs possibles pour la console, et les parcourir en affichant à chaque fois une ligne en couleur comprenant le célèbre "Hello world" suivi du nom de la couleur.

Exemple d'utilisation de Visual Studio

Pour info, voici le code utilisé :

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace FirstEx
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. foreach (String c in Enum.GetNames(typeof(ConsoleColor)))
  11. {
  12. Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), c);
  13. Console.WriteLine("Hello world!!! (" + c + ")");
  14. }
  15. Console.ReadLine();
  16. }
  17. }
  18. }

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 22/09/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/csharp-visual.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.