Sunday, November 27, 2011

how to convert data types in csharp

The Microsoft .net providing a class "Converting" which can be used to convert from any data type into any other data type.Converting is a predefined class which is a part of FCL[Framework Class Library]converting class contains a collection of methods

convert.ToByte(value)
convert.ToChar(value)
convert.ToString(value)
convert.ToFloat(value)
convert.ToDouble(value)
Example on converting:
main()
{
for(i=65;i<=90;i++)
{
char c=convert.Tochar(i);
console.write(c);
}

No comments:

Bel