- Learn how to create classes and instantiate objects that expose encapsulated field data by using class definitions, constructors, and the `new` operator.
After completing this module, you'll be able to:
Describe the .NET type system, the difference between value and reference types, and the benefit of using custom class types.
Explain the difference between a class and an instantiated object.
Create class definitions that include public data fields and constructors that accept zero or more arguments.
Create classes and instantiate objects that expose public field values.
- Learn how to implement read-write, read-only, and write-only class properties using property accessors and access modifiers, and how to implement methods and extension methods for a class.
After completing this module, you'll be able to:
Explain how the field, property, and method members of a class are used in the class definition and instantiated objects.
Implement class properties using 'get' and 'set' property accessors.
Create classes that use automatically implemented properties.
Create read-only and write-only properties using access modifiers for properties and property accessors.
Create class methods and overloaded methods that accept zero or more arguments using either 'value' or 'reference' types.
Create extension methods for a class.
Implement classes that use a combination of properties and methods to manage encapsulated data.
- Learn how to implement classes using advanced techniques like static classes, partial classes, and object initializers that can improve the readability, maintainability, and organization of your code.
After completing this module, you'll be able to:
Describe the differences between structured and object-oriented programs, the benefits of encapsulation, and the lifecycle of a class.
Restrict access to classes and members using private, static, and nested classes.
Improve code organization and maintainability using partial classes.
Improve code readability and maintainability using methods that implement named and optional arguments.
Improve code efficiency and readability using object initializers and copy constructors.
Explain the purpose of a class finalizer and the relationship between a finalizer and the garbage collector in .NET.
Master Finance Tools - 35% Off CFI (Code CFI35)
Google AI Professional Certificate - Learn AI Skills That Get You Hired
Overview
Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Syllabus
- Get started with classes and objects
- Introduction
- Compare structured and object-oriented programming
- Examine the .NET type system
- Design and use classes
- Create class constructors and instantiate objects
- Exercise - Create classes and objects in C#
- Module assessment
- Summary
- Implement class properties and methods
- Introduction
- Examine class members
- Get started with class properties and accessors
- Examine automatically implemented properties
- Restrict access to properties
- Implement class methods and parameters
- Implement extension methods for a class
- Exercise - Update a class with properties and methods in C#
- Module assessment
- Summary
- Manage class implementations
- Introduction
- Examine the structure of object-oriented programs
- Implement private, static, and nested classes
- Implement classes using partial classes
- Specify named and optional method arguments
- Instantiate objects using initializers and copy constructors
- Examine class finalizers
- Exercise - Manage class implementations in C# applications
- Module assessment
- Summary