KO CSharp Operator Member Access - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
ะฃะบัะฐัะฝััะบะฐ ยท ะ ัััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซไธญๆ ยท ๆฅๆฌ่ช ยท ํ๊ตญ์ด
ํ์, ํธ์ถ ๋ฐ ์์ธ ์์ฑ
ํธ๋๋ถ C# ยท ์ค์ฉ ๊ฐ์ด๋
์ ์ ๋ฉค๋ฒ๋ฅผ ์ ํํ๊ณ , ()๋ ์ฝ๋ฌ๋ธ์ ํธ์ถํ๊ณ , []๋ ์์๋ ์ธ๋ฑ์๋ฅผ ์ฝ์ต๋๋ค. ?. ๊ทธ๋ฆฌ๊ณ ?[]๋ null์์ ์ก์ธ์ค๋ฅผ ์ข ๋ฃํฉ๋๋ค.
๊ฐ๋จํ ์์ (Example.cs)
์ด ์์ ๋ฅผ Example.cs๋ก ๋ฐ๋ก ์ ์ฅํ๊ณ ์ด ํ์ด์ง์ ๋ค๋ฅธ ์์ ์ ๋
๋ฆฝ์ ์ผ๋ก ์คํํ์ธ์.
Example.cs:
// PROJECT-EXAMPLE
string? name = null;
System.Console.WriteLine(name?.Length ?? 0);
๊ฒฐ๊ณผ:
0
ํต์ฌ๋ก
value.Member / method(args) / items[index] / value?.Member
์์ 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)
{
string text = "ore";
Console.WriteLine(text.ToUpperInvariant());
Console.WriteLine(text[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)
{
string[]? names = null;
Console.WriteLine(names?[0] ?? "Missing");
string? text = "wood";
Console.WriteLine(text?.Length);
}
}
๊ณต์ ์ถ์ฒ: Microsoft ํ์ต.