KO CSharp Collections - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki

Π£ΠΊΡ€Π°Ρ—Π½ΡΡŒΠΊΠ° Β· Русский Β· English Β· Deutsch Β· FranΓ§ais Β· Italiano Β· EspaΓ±ol Β· 繁體中文 Β· ζ—₯本θͺž Β· ν•œκ΅­μ–΄

λͺ©λ‘, 사전, HashSet, λŒ€κΈ°μ—΄ 및 μŠ€νƒ

μ„€λͺ…μ„œ C# Β· μ˜ˆμ‹œ UO

μ»¬λ ‰μ…˜μ€ μž‘μ—…μ— μ˜ν•΄ μ„ νƒλ©λ‹ˆλ‹€: List<T>λŠ” μˆœμ„œκ°€ μ§€μ •λœ λ³€κ²½ κ°€λŠ₯ν•œ λͺ©λ‘μ„ μ €μž₯ν•©λ‹ˆλ‹€. Dictionary<TKey,TValue> - 킀별 κ°’, HashSet<T> - 고유 κ°’, Queue<T> - μˆœμ„œ FIFO, Stack<T> - LIFO. 일반 λ§€κ°œλ³€μˆ˜λŠ” μš”μ†Œ μœ ν˜•μ„ μ§€μ •ν•©λ‹ˆλ‹€.

κ°„λ‹¨ν•œ 예제 (Example.cs)

이 예제λ₯Ό Example.cs둜 λ”°λ‘œ μ €μž₯ν•˜κ³  이 νŽ˜μ΄μ§€μ˜ λ‹€λ₯Έ μ˜ˆμ œμ™€ λ…λ¦½μ μœΌλ‘œ μ‹€ν–‰ν•˜μ„Έμš”.

Example.cs:

// PROJECT-EXAMPLE
var counts = new System.Collections.Generic.List<int> { 2, 3 };
counts.Add(4);
System.Console.WriteLine(counts.Count);

κ²°κ³Ό:

3
var visited = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
visited.Add("backpack");
visited.Add("BACKPACK");
UO.Print($"Unique names: {visited.Count}");
var delays = new Dictionary<string, int>
{
    ["short"] = 100,
    ["long"] = 500
};
if (delays.TryGetValue("short", out int delay))
{
    await WaitAsync(delay);
}
var queue = new Queue<string>();
queue.Enqueue("first");
queue.Enqueue("second");
UO.Print(queue.Dequeue());

μ μ ˆν•œ μ•Œκ³ λ¦¬μ¦˜ 없이 foreach λ™μ•ˆ 일반 μ»¬λ ‰μ…˜μ„ μˆ˜μ •ν•˜μ§€ λ§ˆμ„Έμš”. μŠ€λ ˆλ“œμ˜ λ™μ‹œ μž‘μ—…μ„ μœ„ν•΄ λ³„λ„μ˜ λ™μ‹œ μ»¬λ ‰μ…˜μ΄ μžˆμŠ΅λ‹ˆλ‹€. κ²Œμž„ μž‘μ—…μ„ 자체적으둜 μŠ€λ ˆλ“œλ‘œλΆ€ν„° μ•ˆμ „ν•˜κ²Œ λ§Œλ“€μ§€λŠ” μ•ŠμŠ΅λ‹ˆλ‹€.

곡식 λ¬Έμ„œ: λͺ©λ‘, 사전, HashSet, 큐 및 μŠ€νƒ - Microsoft Learn.

⚠️ **GitHub.com Fallback** ⚠️