lang:csharp:condition
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| lang:csharp:condition [2020/02/17 10:02] – Création sur la base du langage C root | lang:csharp:condition [2020/03/06 21:31] (Version actuelle) – [[[unlikely]] et [[likely]]] : suppression root | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ====if==== | ====if==== | ||
| ===Condition classique=== | ===Condition classique=== | ||
| - | < | + | < |
| if () | if () | ||
| { | { | ||
| Ligne 14: | Ligne 14: | ||
| Attention aux '' | Attention aux '' | ||
| - | < | + | < |
| if () | if () | ||
| if () | if () | ||
| Ligne 21: | Ligne 21: | ||
| une instruction; | une instruction; | ||
| </ | </ | ||
| + | |||
| + | ===Conditions multiples sur une même valeur=== | ||
| + | <code csharp> | ||
| + | using System.Linq; | ||
| + | |||
| + | public static class Ext | ||
| + | { | ||
| + | public static bool In< | ||
| + | { | ||
| + | return args.Contains(obj); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (2.In(1, 2, 3, 4)) | ||
| + | return; | ||
| + | </ | ||
| + | |||
| + | [[https:// | ||
| ====switch==== | ====switch==== | ||
| ===Cas courant=== | ===Cas courant=== | ||
| - | Les '' | + | Les '' |
| - | < | + | < |
| int i = 0; | int i = 0; | ||
| switch (i) | switch (i) | ||
| Ligne 44: | Ligne 62: | ||
| Les variables déclarées dans un '' | Les variables déclarées dans un '' | ||
| - | < | + | < |
| int k = 2; | int k = 2; | ||
| switch (k) | switch (k) | ||
| Ligne 65: | Ligne 83: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | Le '' | ||
| + | |||
lang/csharp/condition.1581930125.txt.gz · Dernière modification : de root
