KO CSharp Keyword is - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
ะฃะบัะฐัะฝััะบะฐ ยท ะ ัััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซไธญๆ ยท ๆฅๆฌ่ช ยท ํ๊ตญ์ด
C#: is
ํธ๋๋ถ C# ยท ์ค์ฉ ๊ฐ์ด๋
๊ฐ์ ์ ํ์ด๋ ์ด๋ฏธ์ง๋ฅผ ํ์ธํ๊ณ ํด๋น ๋ถ๋ถ์ ๋ณ์์ ๋ฐ์ธ๋ฉํ ์ ์์ต๋๋ค.
๊ฐ๋จํ ์์ (Example.cs)
์ด ์์ ๋ฅผ Example.cs๋ก ๋ฐ๋ก ์ ์ฅํ๊ณ ์ด ํ์ด์ง์ ๋ค๋ฅธ ์์ ์ ๋
๋ฆฝ์ ์ผ๋ก ์คํํ์ธ์.
Example.cs:
// PROJECT-EXAMPLE
object value = 7;
if (value is int number) System.Console.WriteLine(number + 1);
๊ฒฐ๊ณผ:
8
ํต์ฌ๋ก
value is Type variable / value is pattern
์์ 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)
{
object value = 12;
if (value is int number) Console.WriteLine(number + 1);
}
}
์ 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[] values = [1, 2, 3];
Console.WriteLine(values is [1, .., 3]);
}
}
๊ณต์ ์ถ์ฒ: Microsoft ํ์ต.