Home > Article > Backend Development > What is the base class for all data types in C#.NET?
Object is the base class for all data types in C#. Object types are the ultimate base class for all data types in the C# Common Type System (CTS). This object is an alias for the System.Object class.
When a value type is converted to an object type, it is called boxing; on the other hand, when an object type is converted to a value type, it is called boxing. It's 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); } } }
The above is the detailed content of What is the base class for all data types in C#.NET?. For more information, please follow other related articles on the PHP Chinese website!