Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Validating on Overridable method
Message
De
05/09/2011 15:17:07
 
 
À
05/09/2011 14:53:41
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01522449
Message ID:
01522755
Vues:
20
>>As long as you are sure it's safe.
>>If someone can sub-class your base class there's nothing to stop them deriving from the derived class - in which case your code would break. If your class is directly derived from Object then you could identify it like this:
Dim parent As Type = t ' where t is type of actual class
>>While True
>>	If parent.BaseType = GetType([Object]) Then
>>		Exit While
>>	Else
>>		parent = parent.BaseType
>>	End If
>>End While
>>
>>'Parent is now your base class
>>
>>
>>But at that point it probably makes as much sense to pass in the name of the class anyway....
>
>As this is at the framework level, I would like to make it more bullet proof. Also, the framework as some sub classes of the DataEntry class itself. So, I need to fine tune here. Could you elaborate more on the If condition in here which will exit the While? I understand it is a comparism to know if we have reached the top level. So, for as long as the While goes, we climb the chain. But, what does Object represent in that line?

The class from which all other .NET reference types are derived. If you simply declare a class without specifying a base class then it derives from System.Object.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform