(Brackets)
This is a type of explicit conversion
If this conversion is not possible then an exception is thrown.
This requires a cast operator and is also known as Casting or Prefix Casting.
int myint = 10;
short myshort1 = (short)myint;
This is an example of a narrowing conversion
For classes an explicit conversion is needed to convert a base class to a derived class.
public class Base {}
public class Derived : Base {}
Derived D = (Derived)(new Base());
Excel - Does this work ?
int myValue;
myValue = (int)cell.Left;
myValue = (float)cell.Left;
myValue = (double)cell.Left;
myValue = (single)cell.Left;
Worksheet.Shapes.addPicture(,,, System.Convert.ToSingle(Cell.Left,
VB.Net
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext