Join Reynald Adolphe for an in-depth discussion in this video Resolving conflicting instance methods, part of C# 6.0 First Look.
- In our last video regarding the using clause,…we discussed how when it comes to choosing between…instance versus static method with identical names,…the compiler will always choose the instance.…Well when implementing the using clause,…what if you created a static class…which prevents you from having an instance?…Let's modify our Writer class to see what happens.…In our Writer class, let's go to where we specify,…we define, that it's a writer,…and add static.…
And of course, if the class is static,…we need to make sure that its members are also static.…So let's do that for StartTest…and for WriteLine, for both those methods.…Now let's go ahead and save,…and hop back to our Program class.…And at the very top of the page,…let's go ahead and add…using static,…and import our Writer class into scope…the same way we did with System.Console…and System.Math.…
And now, at the bottom of your screen,…you'll see an error.…The call is ambiguous between the two following methods,…and if we double click on this,…it'll bring us to our method where there's an issue.…
- Introducing the new IDE in Visual Studio 2015
- Leveraging nameof expressions
- Using index initializers
- Using await in catch and finally blocks
- Using static
- Resolving conflict instance methods
Skill Level Beginner
1. Touring the Enhanced IDE
2. Expression-Level Features
3. Statement-Level Features
Adding exception filters2m 42s
4. Member Declaration and Initialization Features
5. Improved Debugging
- 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.