This video shows the reference locals and return features that are available in Visual Studio 2017 with C# 7.
- [Narrator] When dealing with methods…that return items defined elsewhere,…they'd only been returned by a value.…You can only get a copy of the value…and could not change the original.…Now with C# 7, we can return a reference…to the value from the method and change it directly.…So let's look at where we might use that.…So I'm going to open up under the view models folder,…the displacement view model.…And right at the top here we…can see we have an array defined.…The array contains bore and stroke values…for common Volkswagen engines.…
If the user enters a bore displacement value,…it calls the GetLargestValueIndex function,…then returns the index of an item in the array that matches.…So lets look at that function.…Now here we can see the GetLargestValue method…and it actually just returns an int…which is the index that it finds.…Now instead of returning the index…to the found engine record,…we want to return a reference to…the displacement value itself.…So I'm going to rename this method to GetLargestValue…because we're actually returning the value.…
- 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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.