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 ํ•™์Šต.