C# Tutorials - Herong's Tutorial Examples - v3.32, by Herong Yang
Type System Unification
This section describes type system unification. All types in C# are derived from 'object'.
C# has an interesting feature called "Type System Unification". In C#, all types, value based or reference based, predefined or user defined, are all derived from "object". The following program shows some interesting elements of this feature:
// Boxing.cs // Copyright (c) 2006 HerongYang.com. All Rights Reserved. using System; class Boxing { static void Main() { int i = 123; object o = i; int j = (int) o; Console.WriteLine("i = {0}",i); Console.WriteLine("object = {0}",o.ToString()); Console.WriteLine("j = {0}",j); } }
Output:
i = 123 object = 123 j = 123
Table of Contents
Logical Expressions and Conditional Statements
Simple Types Are "struct" Types
Visual C# 2010 Express Edition
C# Compiler and Intermediate Language
Compiling C# Source Code Files
MSBuild - Microsoft Build Engine
System.Diagnostics.FileVersionInfo Class
WPF - Windows Presentation Foundation