Saturday, February 28, 2009

C# Changing Types the correct way

C# is simple, but changing variable types might get people confused. Heres the illegal way to change variable types:

Incorrect Way

int x;
long value = 10;
x = value;

Correct Way

int x;
long value = 10;
x = (int) value;

Have Fun

No comments:

Post a Comment