This video examines how generalized return types can increase performance of some async methods in C# 7.
- [Instructor] There are some cases…where the async await pattern…is more expensive than it needs to be,…due to the fact that it could only return…a task, a generic task, or void.…The task is a reference type,…which makes using it a relatively expensive return type,…even if asynchronous code is never called.…I'm going to open up the mock data store under services.…We'll look at the get items, async method.…The only time it calls an asynchronous method…is to load the cars collection.…
This happens when the isInitialized variable…is set to false,…otherwise it just returns…the already loaded cars collection.…However, since this method returns a task,…a task object always has to be created,…even if there is no asynchronous work to be done.…In C sharp seven, we now have a structure called value task.…If you recall, a structure is a value type…instead of a reference type,…and can create less overhead.…Like a generic task, a value task can also return a value…from a asynchronous method without instantiating…the more expensive generic task reference type.…
- Working with tuples
- Using C# throw expressions
- Inspecting UI structures with Xamarin Inspector
- Identifying memory leaks in iOS and Android
- Recording and playing back tests with Test Record
- Using embedded assemblies in Android
Skill Level Intermediate
1. C# 7 Language Improvements
Inspecting UI structures3m 34s
4. Test Recorder
5. Embedded Assemblies
Where to go from here1m 54s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.