In this project, I created various examples and applications to understand important concepts in the C# language. Below are the key topics covered in this project along with related questions:
- Covariance and Contravariance: Concepts related to type conversion in generic types, such as the ability to convert a subclass to a superclass type.
- Boxing and Unboxing: The process of converting value types to reference types and vice versa.
- Polymorphism: How methods can be redefined in different classes.
- Type Conversion: Methods of type conversion, including implicit (covert) and explicit (overt) conversions.
- Generic Conversions: Conversion processes for generic types.
- Delegate and Array: Usage and management of delegates and arrays.
- Upcasting and Downcasting: Type conversion between parent and child types.
- Assignment Compatibility: Compatibility of assignments between different types.
This project is structured as a console application containing various examples related to the above topics. Each section includes classes and interfaces designed to explain a specific concept.
- Polymorphism - Method Overriding: Demonstrates polymorphism using the
Vehicle
,Car
, andBike
classes. - Upcasting and Downcasting: Includes examples that examine conversions between the
Car
andVehicle
classes. - Assignment Compatibility: Explains assignment compatibility between
object
andstring
types. - Covariance and Contravariance: Provides examples of how to use generic interfaces.
- Explicit and Implicit Conversion: Presents examples of implicit and explicit conversion with a
Temperature
class that converts temperature units.
This project provides examples and applications that will help you understand complex concepts in the C# language. Explore how to use these concepts as you develop your code and deepen your understanding.
To run your project, follow these steps:
- Download or clone the project files.
- Open your C# development environment (e.g., Rider, Visual Studio or .NET CLI).
- Open the project file and run it.
git clone <repository-url>
cd <project-directory>
dotnet run