Consuming data types in C#

C# is a strongly-typed language. This basically means that, when we declare a variable with a particular data type, as in the following example, we cannot declare the x variable again:

int x = 5;

In addition to this, we cannot assign to this x variable any value that is not an integer. Hence, the following statement will give us an error:

x = "Hello";

To overcome this strongly typed feature, C# provides some capabilities when we are consuming a type. This includes boxing and unboxing of value type variables, use of the dynamics keyword, and implicit and explicit conversion of a variable of one data type to a variable of a different data type. Let's go through each of these concepts and understand how they work in C#.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.252.56