Dictionary를 다른 Dictionary에 복사하는 방법
1. Constructor를 사용한 복사Dictionary originalDict = new Dictionary(){ { "One", 1 }, { "Two", 2 }, { "Three", 3 }};Dictionary copiedDict = new Dictionary(originalDict); 2. ToDictionary() 메소드를 사용한 복사using System.Linq;Dictionary originalDict = new Dictionary(){ { "One", 1 }, { "Two", 2 }, { "Three", 3 }};Dictionary copiedDict = originalDict.ToDictionary(entry => entry.Key, entry => en..
2024. 9. 29.
가변 인수
가변 인수 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Params { internal class Program { static void Main(string[] args) { params_int(1, 2, 3, 4, 5); params_object(1, 'a', "Hello", "World"); int[] ints = { 1, 2, 3, 4, 5 }; params_int(ints); object[] objs = { 1, 'a', "one", "two", 10 }; params_object(objs); Console.ReadL..
2022. 6. 30.