SHASHANGKA SHEKHAR'S BLOG

Hi, I am Shashangka Shekhar, Working with Microsoft Technologies. This is my personal blog where I share some of my experiences.

Casting and Type Conversions

Type conversion is converting one type of data to another type. It is also known as Type Casting. In C#, type casting has two forms:

  • Implicit type conversion – These conversions are performed by C# in a type-safe manner. For example, are conversions from smaller to larger integral types and conversions from derived classes to base classes.(সফটওয়ারের দায়িত্তে)
  • Explicit type conversion – These conversions are done explicitly by users using the pre-defined functions. Explicit conversions require a cast operator.(নিজের দায়িত্তে)

The following example shows an implicit type conversion:

The following example shows an explicit type conversion:

 

Post a comment