Datatype conversion in C# and VB


C#

In c# we can convert by casting
int y;
Datatype x = (Datatype) y;

Data types:

byte, sbyte, short, ushort, int, uint, long, ulong, float, double, decimal, char, A Unicode character, string, bool, object

Visual Basic has classes for all data type conversions. Here is a list of classes.

CBool - convert to Bool data type
CByte - convert to Byte data type
CChar - convert to Char data type
CDate - convert to Date type
CDbl - convert to Double data type
CDec - convert to Integer data type
CLng - convert to Long data type
CObj - convert to Object type
CShort - convert to Short data type
CSng - convert to Single data type
CString - convert to String data type

Ebook Download
View all
Learn
View all