KO CSharp Operator Collection Expression - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki

ะฃะบั€ะฐั—ะฝััŒะบะฐ ยท ะ ัƒััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซ”ไธญๆ–‡ ยท ๆ—ฅๆœฌ่ชž ยท ํ•œ๊ตญ์–ด

์ˆ˜์ง‘ ๋ฐ ํ™•์‚ฐ

ํ•ธ๋“œ๋ถ C# ยท ์‹ค์šฉ ๊ฐ€์ด๋“œ

์ปฌ๋ ‰์…˜ ํ‘œํ˜„์‹์—๋Š” ๋Œ€์ƒ ์œ ํ˜•์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์Šคํ”„๋ ˆ๋“œ๋Š” ๋‹ค๋ฅธ ์‹œํ€€์Šค์˜ ์š”์†Œ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ํ™•์‚ฐ๊ณผ ๋ฒ”์œ„๋ฅผ ํ˜ผ๋™ํ•˜์ง€ ๋งˆ์‹ญ์‹œ์˜ค.

๊ฐ„๋‹จํ•œ ์˜ˆ์ œ (Example.cs)

์ด ์˜ˆ์ œ๋ฅผ Example.cs๋กœ ๋”ฐ๋กœ ์ €์žฅํ•˜๊ณ  ์ด ํŽ˜์ด์ง€์˜ ๋‹ค๋ฅธ ์˜ˆ์ œ์™€ ๋…๋ฆฝ์ ์œผ๋กœ ์‹คํ–‰ํ•˜์„ธ์š”.

Example.cs:

// PROJECT-EXAMPLE
int[] first = [1, 2];
int[] all = [.. first, 3];
System.Console.WriteLine(string.Join(",", all));

๊ฒฐ๊ณผ:

1,2,3

ํ†ต์‚ฌ๋ก 

int[] values = [1, ..other, 5];

์˜ˆ์‹œ 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)
    {
        int[] middle = [2, 3];
        int[] values = [1, ..middle, 4];
        Console.WriteLine(string.Join(",", values));
    }
}

์˜ˆ์‹œ 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)
    {
        List<string> names = ["ore", "wood"];
        List<string> all = [..names, "food"];
        Console.WriteLine(all.Count);
    }
}

๊ณต์‹ ์ถœ์ฒ˜: Microsoft ํ•™์Šต.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ