KO CSharp Keyword static - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
ะฃะบัะฐัะฝััะบะฐ ยท ะ ัััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซไธญๆ ยท ๆฅๆฌ่ช ยท ํ๊ตญ์ด
C#: static
ํธ๋๋ถ C# ยท ์ค์ฉ ๊ฐ์ด๋
์ธ์คํด์ค ๋์ ํ์์ ๋ฉค๋ฒ๋ฅผ ๋ฐ์ธ๋ฉํฉ๋๋ค. ์ ์ ํด๋์ค์๋ ์ ์ ๋ฉค๋ฒ๋ง ํฌํจ๋ฉ๋๋ค. ์ ์ ๋๋ค๋ ์ง์ญ ๋ณ์๋ฅผ ์บก์ฒํ์ง ์์ต๋๋ค.
๊ฐ๋จํ ์์ (Example.cs)
์ด ์์ ๋ฅผ Example.cs๋ก ๋ฐ๋ก ์ ์ฅํ๊ณ ์ด ํ์ด์ง์ ๋ค๋ฅธ ์์ ์ ๋
๋ฆฝ์ ์ผ๋ก ์คํํ์ธ์.
Example.cs:
// PROJECT-EXAMPLE
System.Console.WriteLine(Tools.Double(4));
static class Tools { public static int Double(int x) => x * 2; }
๊ฒฐ๊ณผ:
8
ํต์ฌ๋ก
static class Tools { public static int Value { get; } }
์์ 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)
{
Console.WriteLine(Tools.Double(6));
}
}
public static class Tools { public static int Double(int value) => value * 2; }
์ 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.Select(static value => value * value).Sum());
}
}
๊ณต์ ์ถ์ฒ: Microsoft ํ์ต.