
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What is the base class for all data types in C#.NET?
Object is the base class for all data types in C#. The Object Type is the ultimate base class for all data types in C# Common Type System (CTS). The object is an alias for System.Object class.
When a value type is converted to object type, it is called boxing and on the other hand, when an object type is converted to a value type, it is called unboxing.
The following is an example showing the usage of object data types −
using System; using System.IO; namespace Demo { class objectClass { public int x = 56; } class MyApplication { static void Main() { object obj; obj = 96; Console.WriteLine(obj); obj = new objectClass(); objectClass newRef; newRef = (objectClass)obj; Console.WriteLine(newRef.x); } } }
- Related Articles
- What is the base class for all exceptions in C#?
- What is the base class for errors and exceptions in Java?
- What is a base class in C#?
- What is a virtual base class in C++?
- Why Object class is the super class for all classes in Java?
- Explain the custom value types in .NET
- What is Elementary Data Types?
- Hiding of all overloaded methods in base class in C++
- What is COBOL host variable equivalent for various DB2 data types?
- What is the concept of Data Types in JavaScript?
- Python Data Types for Data Science
- What are the data types, value types and reference types in C#?
- How base-class is defined in Swift?
- What is the difference between data types and literals in Java?
- What are the default values used by DB2 for various data types?

Advertisements