Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Casting errors should be caught during compiling, right?
Message
 
À
21/11/2004 16:25:11
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Divers
Thread ID:
00963257
Message ID:
00963566
Vues:
7
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform