Repository navigation
FR CSharp Keyword short
Codex edited this page Oct 11, 2026
·
2 revisions
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Un entier signé 16-bit.
Enregistrez cet exemple séparément dans Example.cs. Exécutez-le indépendamment des autres exemples de cette page.
Example.cs:
// PROJECT-EXAMPLE
short amount = 12;
System.Console.WriteLine(amount + 2);Résultat:
14
short value = 120;Le type de variable détermine la plage et les règles de l'arithmétique. Pour vérifier le débordement d'entiers, utilisez vérifié; pour la conversion de texte — TryParse.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
public static class Program
{
public static async Task Main(string[] args)
{
short first = 120;
short second = 2;
Console.WriteLine(first + second);
}
}using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
public static class Program
{
public static async Task Main(string[] args)
{
short[] values = [120, 2, 3];
foreach (short value in values) Console.WriteLine(value);
Console.WriteLine(short.MaxValue);
}
}Source officielle : Microsoft Apprendre.
ClassicUO — Bad Newbie & C# Scripts IDE