C# Documentation - Objects and Types

Introduction

This page provides a comprehensive overview of C# object and type concepts, including fundamental types, inheritance, polymorphism, and more. Explore the core building blocks of the C# language.

Basic Types

C# has several basic types, each with specific characteristics:

Derived Types

Derived types are created from other types using the operator 'extends'.

Example:

Element DerivedFrom

Inheritance

Inheritance allows you to create new types based on existing ones, inheriting their properties and methods.

Example:

Animal Dog

Polymorphism

Polymorphism allows you to write code that can work with multiple types.

Example:

Animal Dog

Data Structures

C# provides various data structures to organize and manage data effectively, such as arrays, lists, dictionaries, and sets.

``` ```css /* style.css */ body { font-family: sans-serif; margin: 0; padding: 0; background-color: #f4f4f4; color: #333; } header { background-color: #29819D; color: white; padding: 1em; text-align: center; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); } main { padding: 20px; width: 80%; margin-bottom: 20px; background-color: #fff; } section { padding: 1em; margin-bottom: 20px; border: 1px solid #ddd; border-radius: 5px; background-color: #333; } h1 { font-size: 2.5em; font-weight: bold; margin-bottom: 0.5em; } h2 { font-size: 1.8em; margin-bottom: 0.5em; } p { line-height: 1.6; } ul { list-style-type: square; margin-left: 20px; } .derived-type { font-size: 1.2em; font-weight: bold; color: #2C6B8B; margin-bottom: 10px; } .inheritance { font-size: 1.1em; font-weight: bold; color: #4CAF50; margin-bottom: 10px; } .polymorphism { font-size: 1.1em; font-weight: bold; color: #ADD8E6; margin-bottom: 10px; } .base { font-size: 1em; font-weight: bold; color: #95A74F; } .derived { font-size: 1.2em; font-weight: bold; color: #F4A48C; } footer { background-color: #29819D; color: white; text-align: center; padding: 1em; position: absolute; bottom: 0; left: 0; width: 100%; text-align: center; } /* Example layout of the page. Add more elements as needed */