Converting - Explicit
Also known as Type Casting.
There are a number of different ways we can make an explicit data type conversion.
(Brackets)
Integer to Long
int myInteger;
long myLong;
myInteger = 10;
myLong = (long)myInteger;
Console.WriteLine(myLong);
System.Convert
System.BitConverter
as Operator
Object.Parse()
??
int myInt = System.Int32.Parse(mytext);
decimal myDecimal = System.Decimal.Parse(mytext);
Boxing
Unboxing
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext