If you are working with C# I’m pretty sure that you used a lambda expression (an action, a predicate, a delegate or a function). Basically you can define a block of code inline (function) and execute this code when you need it. For all of you, that already used this features of C# I have a simple question: Does the lambda expression executes on the same thread or is executing on a different thread? This information can be very important because running code on a different thread can be expensive. Not only this, there are times when we can have content that is static on the thread and not on our current process. The simplest way to check this is to write a simple console application that displays the thread id. class Program { static void Main(string[] args) { DisplayCurrentThreadId(); Action myAction = DisplayCurrentThreadId; myAction.Invoke(); myAction.Invoke(); DisplayCurrentThreadId(); Console.Read...
DREAMER, CRAFTER, TECHNOLOGY ENTHUSIAST, SPEAKER, TRAINER, AZURE MVP, SOLVING HARD BUSINESS PROBLEMS WITH CUTTING-EDGE TECHNOLOGY