Explore and implement auto-properties in C#.
- [Instructor] With our character class defined…it's time to start actually adding some code to this class.…We're going to start with auto properties.…Auto properties are part of C Sharp's encapsulation system.…We'll talk more about encapsulation in the next video…when you see a nice contrast to the technique we're about…to use here.…So let's talk a look at auto properties.…When you're creating properties in a C Sharp class,…you generally need to define their access modifier.…
An access modifier is a key word…that tells C Sharp who or what should have access…to this particular member of this particular class.…So let's make a few and I'll show you what I mean.…I'll put in public, string, character name.…The public keyword at the front of the line indicates…that the character name will be visible…outside of this class.…String indicates that the character name variable…or property that we're creating…can only contain string as its data type.…
If you try to put integer into it,…you'll get a compile error.…Now if I go ahead and close this off with a semicolon,…
AuthorBruce Van Horn
- Exploring C# on a Mac
- Creating a reusable code library
- Classes and properties
- Loops, arrays, and lists
- Creating a console app
- Creating a command-line app
- Creating a Mac desktop app
- Creating a UI with view controllers and actions
Skill Level Beginner
Docker for .NET Developers with Visual Studiowith Lee Brandt46m 52s Intermediate
1. C# on the Mac?
2. Getting Started with C#
3. Deeper into C#
4. Creating a Mac App
Next steps3m 14s
- 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.