What are reference data types in C#?

CsharpProgrammingServer Side Programming

The reference data type in C# does not have the actual data stored in a variable, but they contain a reference to the variables.

In C#, the following are the built-in reference types −

Object Type

The Object Type is the ultimate base class for all data types in C# Common Type System (CTS). The object types can be assigned values of any other types, value types, reference types, predefined or user-defined types.

Example

object ob;
ob = 250; // boxing

Dynamic Type

Store any type of value in the dynamic data type variable. Type checking for these types of variables takes place at run-time.

Example

dynamic d = 100;

String Type

The String Type allows you to assign any string values to a variable. The string type is an alias for the System.String class. It is derived from object type.

Example

String val = "Welcome!";
raja
Published on 13-Aug-2018 10:31:51
Advertisements