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:
- int: Integer - Whole numbers.
- float: Single-precision floating-point number.
- double: Double-precision floating-point number.
- bool: Boolean – True or False.
- char: Single character.
- string: Sequence of characters.
Derived Types
Derived types are created from other types using the operator 'extends'.
Example:
Inheritance
Inheritance allows you to create new types based on existing ones, inheriting their properties and methods.
Example:
Polymorphism
Polymorphism allows you to write code that can work with multiple types.
Example:
Data Structures
C# provides various data structures to organize and manage data effectively, such as arrays, lists, dictionaries, and sets.