Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Casting errors should be caught during compiling, right?
Message
 
To
21/11/2004 16:25:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00963257
Message ID:
00963566
Views:
8
It has everything to do with object casting. GetColumnValueAtRow returns an object which it cannot cast to DateTime. You can simulate the runtime exception with this code. The compiler doesn't catch it.
DateTime d;
Object o = DBNull.Value;
d = (DateTime)o; // Runtime exception here
Bottom line is that object references mean no strong typing.

>PS: Casting to object is special case and not the thing here.
Previous
Reply
Map
View

Click here to load this message in the networking platform