Join Reynald Adolphe for an in-depth discussion in this video Checking for null, part of C# Best Practices for Developers.
- [Instructor] One of the first lessons I've learned…when developing, and I remember my mentor was telling me…this with a very deep voice, and there should have been…dramatic music playing in the background because…he sounded so serious.…And it was to always, always, always check for null.…Always.…And I've always remembered that.…And when we've had to check for null,…we've had to write a little bit of extra syntax,…but now we have the Null Conditional Operator.…And let me show you exactly what I mean.…You may have noticed that in our Actor Class,…there were a couple of areas, such as over here,…where we are using this question mark.…
But what's happening is that it's checking to see…if value is null, and if it is,…it's not going to try to invoke Trim.…Now what's nice about that is that it prevents the code…from just blowing up on you,…from a system exception error happening.…And let me go ahead and demonstrate what I'm talking about.…I'll hop on over to our program file under Prestige.Biz…and let's say that were going to write out…
- Naming and handling classes
- Running a unit test
- Using constructors
- Naming and handling methods, fields, and properties
- Using properties correctly
- Managing objects efficiently
- Common design patterns as best practices
Skill Level Intermediate
1. Best Practices: An Overview
2. Naming and Handling Classes
3. Naming and Handling Methods, Fields, and Properties
4. Managing Objects Efficiently
5. More Best Practices Resources
- 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.