Chapter 12 - Improving Performance and Scalability with Multitasking
- By convention, what suffix should be applied to a method that returns a
Task
or aTask<T>
?- Async, for example,
OpenAsync
for a method namedOpen
.
- Async, for example,
- To use the
await
keyword inside a method, which keyword must be applied to the method declaration?- The
async
keyword must be applied to the method declaration.
- The
- How do you create a child task?
- Call the
Task.Factory.StartNew
method with theTaskCreationOptions.AttachToParent
option to create a child task.
- Call the
- Why should you avoid the
lock
keyword?- The
lock
keyword does not allow you to specify a timeout; this can cause deadlocks. UseMonitor.Enter
with aTimeSpan
andMonitor.Exit
instead.
- The
- When should you use the
Interlocked
class?- If you have integers ...
Get C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.