Join Anton Delsink for an in-depth discussion in this video Implement method ChessMove.Try, part of Object Oriented Programming with C#.
- [Instructor] Okay, so I'll leave the validation to you.…Let's set up the before and after variables.…So the beforeBoard is going to be the chessboard…before we make a move…and the after will be the chessboard after we make a move.…If result, as the incoming move,…has a board,…so result is not null, so the afterBoard.Clone…would be our beforeBoard.…So the incoming chess move result,…we're going to ask it when it was finished,…what did the board look like.…
So that's going to be our starting point.…Copy and paste.…Because then our…afterBoard is the one we're going to be modifying.…Now, the catch here is, Clone, of course,…is going to give us just something of type object…and so I do want to cast this.…It's going to be a two-dimensional array.…Again, I'll copy and paste.…And so now, we have result.After.Clone.…And so we'll get a copy of the board,…if there's a previous move, a copy of the board as it was…just before we did our part.…
Now, there is another catch here.…Result, of course, on the very first move, will be null…
- Abstract classes
- Processing text with StreamReader
- IEnumerable and yield return
- Windows Forms controls
- Windows Forms with and without the designer
- Adding, organizing, and testing forms
- Creating classes
Skill Level Intermediate
C# Object-Oriented Programming Tips and Trickswith Jesse Freeman58m 39s Intermediate
What you should know1m 10s
1. Theory vs. Practice
2. Examples from .NET
3. Examples from Windows UI
4. Examples from Board Games
5. Examples from the Web
Next steps1m 13s
- 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.