KO CSharp Keyword unchecked - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
ะฃะบัะฐัะฝััะบะฐ ยท ะ ัััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซไธญๆ ยท ๆฅๆฌ่ช ยท ํ๊ตญ์ด
C#: unchecked
ํธ๋๋ถ C# ยท ์ค์ฉ ๊ฐ์ด๋
์ผ์นํ๋ ์ ์ ์ค๋ฒํ๋ก ๊ฒ์ฌ๋ฅผ ๋นํ์ฑํํฉ๋๋ค. ๊ฒฐ๊ณผ๋ ์ ํ ๋ฒ์๋ก ์๋ฆฝ๋๋ค.
๊ฐ๋จํ ์์ (Example.cs)
์ด ์์ ๋ฅผ Example.cs๋ก ๋ฐ๋ก ์ ์ฅํ๊ณ ์ด ํ์ด์ง์ ๋ค๋ฅธ ์์ ์ ๋
๋ฆฝ์ ์ผ๋ก ์คํํ์ธ์.
Example.cs:
// PROJECT-EXAMPLE
int value = int.MaxValue;
System.Console.WriteLine(unchecked(value + 1));
๊ฒฐ๊ณผ:
-2147483648
ํต์ฌ๋ก
unchecked(expression) / unchecked { ... }
์์ 1: ๊ธฐ๋ณธ ํํ
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)
{
int maximum = int.MaxValue;
try { Console.WriteLine(checked(maximum + 1)); } catch (OverflowException) { Console.WriteLine("Overflow"); }
}
}
์ 2: ๋ ๋ค๋ฅธ ์ค์ ํ์
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)
{
int maximum = int.MaxValue;
int wrapped = unchecked(maximum + 1);
Console.WriteLine(wrapped);
}
}
๊ณต์ ์ถ์ฒ: Microsoft ํ์ต.