Basically you follow some standered protcol like Async and Await and Thread safe mechanism due to that your main thread is not block anytime and flow of execution is working properly without core dependencies.
By choosin the best algorithm and data structure to solve the task,
As per MSDN We Can write safe and efficient code by using Declare immutable structs as readonlyreference - https://docs.microsoft.com/en-us/dotnet/csharp/write-safe-efficient-code