(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());
VB.Net
© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext