Hi
If you take an object of unknown type and try
to cast it to the desired type, then it is the same
as C#'s () cast:
VB:
Dim o As Object = SomeObject()
Dim i As Integer = DirectCast(o, Integer)
C#:
object o = SomeObject();
int i = (int)o;
This is because, if o is typed as a System.Object,
then the () operation in C# will attempt to unbox
it. This will fail if the types don't match exactly;
for instance, if o is a boxed System.Double,
then (int)o will throw an exception because o must be unboxed as a System.Double before it can be
converted to a System.Int32
Regards
Sridhar Thota.
If you learn't from defeat..
You haven't really lost..
Sridhar Thota.
Editor: DNS Forum.