1
다음을 람다 식으로 변환하는 방법은 무엇입니까?C# 람다 식 변환
// The underscore is simply a placeholder for the "state"
// parameter that the WaitCallback delegate expects - you could
// use any character but you must specify one as lamba expressions cannot
// omit parameters like anonymous functions can.
ThreadPool.QueueUserWorkItem((_) =>
{
Console.WriteLine("Current Thread Id is {0}:",
Thread.CurrentThread.ManagedThreadId);
Console.WriteLine("I will be used as Callback");
});
을하지만 람다 표현식은 소스 코드의 외부 아무런 의미가 없다는 것을 기억
ThreadPool.QueueUserWorkItem(delegate
{
Console.WriteLine("Current Thread Id is {0}:",
Thread.CurrentThread.ManagedThreadId);
Console.WriteLine("I will be used as Callback");
}
);
Andrew, "_"(밑줄)의 용도는 무엇입니까? – user215675
오! 코드에서 주석을 얻었습니다. – user215675
죄송합니다. 댓글에 있습니다. 기본적으로 자리 표시자가되기 위해 * something *을 던져야합니다. –