Skip to main content

TYPE CASTING in C#

Type casting is a process in which you will convert one type of data into another type of data
  1. Implicit Type Casting
  2. Explicit Type Casting
Implicit Type Casting
Implicit type casting is the casting which is done by your CLR of compiler. In this type of casting it will itself convert one type into another type. But the only condition is that the conversion must be compatible.
Example
Int x = 5;
Float y = 6f;
y=x;
Explicit Type Casting
Explicit is the process in which we manually convert the one type of data into another type of data. But there is a chance of data loss in type of explicit type of casting. Apart from this the data type must be compatible.

Comments

Popular posts from this blog

Asp.net Component Model

ASP.Net Component Model: The ASP.Net component model provides various building blocks of ASP.Net pages. Basically it is an object model, which describes: ·          Server side counterparts of almost all HTML elements or tags, like <form> and <input>. ·          Server controls, which help in developing complex user-interface for example the Calendar control or the Gridview control. ASP.Net is a technology, which works on the .Net framework that contains all web-related functionalities. The .Net framework is made of an object-oriented hierarchy. An ASP.Net web application is made of pages. When a user requests an ASP.Net page, the IIS delegates the processing of the page to the ASP.Net runtime system. The ASP.Net runtime transforms the .aspx page into an instance of a class, which inherits from the base class Page of the .Net framework. Therefore, each ASP.Net page is an object and a...