Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dogaaydinn/csharp-covariance-polymorphism-exercises
Understanding Advanced C# Concepts
https://github.com/dogaaydinn/csharp-covariance-polymorphism-exercises
array assignment-compatibility boxing-unboxing contravariance conversion covariance csharp delegate downcasting explicit-conversion generic implicit-conversion polymorphism upcasting
Last synced: about 1 month ago
JSON representation
Understanding Advanced C# Concepts
- Host: GitHub
- URL: https://github.com/dogaaydinn/csharp-covariance-polymorphism-exercises
- Owner: dogaaydinn
- License: mit
- Created: 2024-10-15T15:40:00.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-10-15T15:53:53.000Z (4 months ago)
- Last Synced: 2024-10-16T19:49:08.768Z (4 months ago)
- Topics: array, assignment-compatibility, boxing-unboxing, contravariance, conversion, covariance, csharp, delegate, downcasting, explicit-conversion, generic, implicit-conversion, polymorphism, upcasting
- Language: C#
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Project Title: Understanding Advanced C# Concepts
## About
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.## Project Structure
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.
### Examples
1. **Polymorphism - Method Overriding**: Demonstrates polymorphism using the `Vehicle`, `Car`, and `Bike` classes.
2. **Upcasting and Downcasting**: Includes examples that examine conversions between the `Car` and `Vehicle` classes.
3. **Assignment Compatibility**: Explains assignment compatibility between `object` and `string` types.
4. **Covariance and Contravariance**: Provides examples of how to use generic interfaces.
5. **Explicit and Implicit Conversion**: Presents examples of implicit and explicit conversion with a `Temperature` class that converts temperature units.## Conclusion
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.## Usage
To run your project, follow these steps:
1. Download or clone the project files.
2. Open your C# development environment (e.g., Rider, Visual Studio or .NET CLI).
3. Open the project file and run it.```bash
git clone
cd
dotnet run