๐Action
class Program
{
//static void Test1(string str, int aa) // ๋งค๊ฐ๋ณ์ ๋ง์์ผ ํจ.
static void Test1(string str)
{
Console.WriteLine("Test1 " + str);
}
static void Test2(string str)
{
Console.WriteLine("Test2 " + str);
}
static void Main(string[] args)
{
List<string> names = new List<string>();
List<string> names2 = new List<string>();
//Action<string, int> ac1 = Test2; // ์ด๊ฑฐ์๋จ. ๋งค๊ฐ๋ณ์ ๋ง์์ผ ํจ.
Action<string> ac1 = Test2;
Action<string> ac2 = delegate (string str)
{
Console.WriteLine("ac2 " + str);
};
Action<string, int> ac3 = (string str, int idx) =>
{
Console.WriteLine("{0} ac3 " + str, idx);
};
for (int i = 0; i < 1; i++)
{
names.Add("Bruce");
names.Add("Alfred");
names.Add("Tim");
names.Add("Richard");
}
names.ForEach((x) =>
{
Console.WriteLine(x);
});
names.ForEach(Test1);
names.ForEach(ac1);
//names.ForEach(ac3); // ์ด๊ฑฐ์๋จ. ๋งค๊ฐ๋ณ์ ์๋ง์.
}
}
Last updated