Table of Contents
Implicit Casting
private static void ImplicitCasting()
{
char c = 'A';
int i = c;
long j = i;
float k = j;
double l = k;
}
Explicit Casting
private static void ExplicitCasting()
{
short h = (short)c;
k = (float)l;
j = (long)k;
i = (int)j;
c = (char)i;
}
Type Conversion Class
private static void TypeConversionClass()
{
string s = "1";
i = Convert.ToInt32(s);
string str = "abc";
var a = 1;
// a = Convert.ToInt32("abc"); //not valid (input format exception)
}