Develop object-oriented programming applications
The following quickstart exercises are designed to provide you with a hands-on learning experience in which you’ll explore common tasks that developers do when developing object-oriented applications.
Quickstart exercises
Exercise - Create class definitions and instantiate objects
Learn how to create class definitions that include fields and constructors, and how to use the “new” operator to instantiate objects that expose encapsulated field data.
Exercise - Update a class with properties and methods
Learn how to implement class properties using property accessors and access modifiers, and how to implement methods by adding methods to a class and by developing extension methods for existing classes.
Exercise - Manage class implementations
Learn how to improve code quality by creating static and partial classes, using optional parameters in constructors, and by implementing copy constructors and object initializers in your applications.
Exercise - Implement Interfaces in a Project
Define and implement interfaces in C# to enforce consistent behavior across multiple classes, including explicit interface implementations.
Exercise - Decouple code using Interfaces
Create flexible and maintainable code by refactoring tightly coupled code to use interfaces in C#.
Exercise - Create Flexible Code Using Interfaces
Create flexible and maintainable code by refactoring tightly coupled code to use interfaces in C#.
Exercise - Implement base and derived classes
Learn how to create a class hierarchy that implements base and derived classes. Explore using the abstract, virtual, sealed, new, and override keywords to extend base class behavior in derived classes, and how to access base class members from within a derived class using the base keyword.
Exercise - Implement polymorphism in a C# app
Learn the principles of polymorphism and how to implement polymorphic behavior in C# apps using interface-based and inheritance-based approaches.
Exercise - Implement Basic Date and Time Operations
Learn how to create and manipulate date and time values in C#. Explore using DateTime, DateOnly, TimeOnly, and TimeZoneInfo classes to perform various date and time operations.
Exercise - Create and manage text files
Learn how to create and enumerate directories and files by using the Directory and Path classes, how to read, write, and manage text files by using the File class, how to read and write comma-separated value files by using StreamReader, StreamWriter, and FileStream classes, and how to read and write binary data files by using BinaryReader and BinaryWriter classes.
Exercise - Serialize and deserialize JSON files
Learn how serialize and deserialize JSON using JsonSerializer methods, how to use JsonSerializerOptions to customize serialization and deserialization, and how to use Data Transfer Objects to implement serialization and deserialization when objects cannot be serialized directly.
Exercise - Implement asynchronous tasks
Learn how to improve app responsiveness by converting synchronous methods into asynchronous tasks, and how to reduce performance bottlenecks in your apps by running asynchronous tasks in parallel.
Exercise - Implement Collection Types
Learn how to implement and use collection types in C#. Explore using List, Dictionary, HashSet, and other collection types to manage data effectively.