Repository navigation
IT CSharp Keyword sbyte
Codex edited this page Oct 11, 2026
·
2 revisions
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Un intero con segno 8 bit, da −128 a 127.
Salvare questo esempio separatamente come Example.cs. Eseguirlo indipendentemente dagli altri esempi di questa pagina.
Example.cs:
// PROJECT-EXAMPLE
sbyte amount = 12;
System.Console.WriteLine(amount + 2);Risultato:
14
sbyte value = 12;Il tipo della variabile determina l'intervallo e le regole dell'aritmetica. Per controllare l'eccesso di numeri interi, utilizzare checked; per la conversione del testo — 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)
{
sbyte first = 12;
sbyte 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)
{
sbyte[] values = [12, 2, 3];
foreach (sbyte value in values) Console.WriteLine(value);
Console.WriteLine(sbyte.MaxValue);
}
}Fonte ufficiale: Microsoft Impara.
ClassicUO — Bad Newbie & C# Scripts IDE