Wednesday, April 4, 2012

Type casting with c#.net

Recently i have seen one Query about c to c# data type convert.Type concept is a concept of converting one data type to another data type.C#.net supports two types of typecasting. Implicit Typecasting:It will be done under control of CLR and convert from lower to higher ex:
byte x=10;
int i=x;
byte-->int
Explicit Type Casting:It will be done undercontrol of programmer and convert data type from high to lower
int i=10;
byte x=i;
int-->byte
obs:
long-->Int:-Explicit
float-->double:-Implicit
Int-->Float:-implicit
Float-->Int:-Explicit
C#.Net supports 4 types of methodologies for explicit type casting 1.c++ style of casting 2.Converting 3.Parsing

No comments:

Bel