Information générale
Catégorie:
Code, syntaxe and commandes
>What's the best way to validate that all required properties on a class are completed correctly? The properties will eventually be
>mapped to UI fields, but the class itself is not visual. It's possible to instantiate the class, set some or all properties, and then call
>methods on it. I want to ensure that all required properties are complete before certain methods are run.
>
>The question is what to do if a required property is not set or is set wrong. Throw an exception?
The best route is to catch stuff like this in the UI where possible so that, for example, a button that runs a method isn't enabled until all rewuired property data is present.
But is this for WinForms or ASP.NET since they have very different options ?
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement