KO CSharp Operator Equality - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
ะฃะบัะฐัะฝััะบะฐ ยท ะ ัััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซไธญๆ ยท ๆฅๆฌ่ช ยท ํ๊ตญ์ด
ํ๋ฑ
ํธ๋๋ถ C# ยท ์ค์ฉ ๊ฐ์ด๋
ํ๋ฑ ๋๋ ๋ถํ๋ฑ์ ํ์ธํฉ๋๋ค. ํด๋์ค์ ๊ฒฝ์ฐ ์ผ๋ฐ ๋น๊ต๋ ์ข ์ข ์ฐธ์กฐ๋ฅผ ํ์ธํฉ๋๋ค. string ๋ฐ ๋ ์ฝ๋๋ ๊ฐ๋ณ๋ก ๋์ํฉ๋๋ค.
๊ฐ๋จํ ์์ (Example.cs)
์ด ์์ ๋ฅผ Example.cs๋ก ๋ฐ๋ก ์ ์ฅํ๊ณ ์ด ํ์ด์ง์ ๋ค๋ฅธ ์์ ์ ๋
๋ฆฝ์ ์ผ๋ก ์คํํ์ธ์.
Example.cs:
// PROJECT-EXAMPLE
string first = "ore";
string second = new string(['o', 'r', 'e']);
System.Console.WriteLine(first == second);
๊ฒฐ๊ณผ:
True
ํต์ฌ๋ก
left == right / left != right
์์ 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 left = "ore", right = new string(['o', 'r', 'e']);
Console.WriteLine(left == right);
Console.WriteLine(left != "wood");
}
}
์์ 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)
{
Point first = new(1, 2), second = new(1, 2);
Console.WriteLine(first == second);
}
}
public readonly record struct Point(int X, int Y);
๊ณต์ ์ถ์ฒ: Microsoft ํ์ต.