Click here to Skip to main content
15,917,174 members
Home / Discussions / C#
   

C#

 
Question[Solved] How to handle a null enum retrieved from web service [modified] Pin
Brian Triplett26-Aug-09 2:56
Brian Triplett26-Aug-09 2:56 
AnswerRe: How to handle a null enum retrieved from web service Pin
N a v a n e e t h26-Aug-09 5:04
N a v a n e e t h26-Aug-09 5:04 
GeneralRe: How to handle a null enum retrieved from web service Pin
Brian Triplett26-Aug-09 5:08
Brian Triplett26-Aug-09 5:08 
QuestionSuggestions on how to model a simple validation program Pin
neualex26-Aug-09 2:53
neualex26-Aug-09 2:53 
AnswerRe: Suggestions on how to model a simple validation program Pin
Super Lloyd26-Aug-09 3:12
Super Lloyd26-Aug-09 3:12 
GeneralRe: Suggestions on how to model a simple validation program Pin
neualex26-Aug-09 3:48
neualex26-Aug-09 3:48 
GeneralRe: Suggestions on how to model a simple validation program Pin
Super Lloyd26-Aug-09 3:56
Super Lloyd26-Aug-09 3:56 
AnswerRe: Suggestions on how to model a simple validation program Pin
N a v a n e e t h26-Aug-09 5:20
N a v a n e e t h26-Aug-09 5:20 
The way to do this is to create a common interface and let all your validation classes implement this interface.
C#
public interface IValidator
{
     bool Validate(/* ... */);
}
Keep all the available validation classes full name in the configuration file. You can use reflection to create instance of these classes. To create instance, work with Activator.CreateInstance() method. Cast the return value of Activator.CreateInstance() to IValidator and call Validate() method on this object to perform validation.

You can just modify the configuration file when new validator has to be added. No program recompilation is required.

Smile | :)


QuestionRe: Suggestions on how to model a simple validation program Pin
neualex26-Aug-09 17:49
neualex26-Aug-09 17:49 
AnswerRe: Suggestions on how to model a simple validation program Pin
N a v a n e e t h26-Aug-09 18:25
N a v a n e e t h26-Aug-09 18:25 
QuestionRe: Suggestions on how to model a simple validation program Pin
neualex27-Aug-09 1:56
neualex27-Aug-09 1:56 
AnswerRe: Suggestions on how to model a simple validation program Pin
N a v a n e e t h27-Aug-09 2:23
N a v a n e e t h27-Aug-09 2:23 
GeneralRe: Suggestions on how to model a simple validation program Pin
neualex27-Aug-09 2:30
neualex27-Aug-09 2:30 
Questionproblem with data table Pin
myinstincts26-Aug-09 2:39
myinstincts26-Aug-09 2:39 
AnswerRe: problem with data table Pin
baranils26-Aug-09 4:47
baranils26-Aug-09 4:47 
Questionsyntax error...plz help me Pin
ankitjain111026-Aug-09 2:02
ankitjain111026-Aug-09 2:02 
AnswerRe: syntax error...please help me Pin
Tony Richards26-Aug-09 2:14
Tony Richards26-Aug-09 2:14 
GeneralRe: syntax error...please help me Pin
ankitjain111026-Aug-09 2:22
ankitjain111026-Aug-09 2:22 
AnswerSame question Pin
Not Active26-Aug-09 2:15
mentorNot Active26-Aug-09 2:15 
GeneralRe: Same question Pin
Tony Richards26-Aug-09 2:18
Tony Richards26-Aug-09 2:18 
QuestionDisplay DataGridView Dynamically Pin
Ankit At Codeproject26-Aug-09 1:44
Ankit At Codeproject26-Aug-09 1:44 
AnswerRe: Display DataGridView Dynamically Pin
stancrm26-Aug-09 1:51
stancrm26-Aug-09 1:51 
QuestionListView Context Menu Pin
kanchoette26-Aug-09 1:43
kanchoette26-Aug-09 1:43 
AnswerRe: ListView Context Menu Pin
stancrm26-Aug-09 1:48
stancrm26-Aug-09 1:48 
GeneralRe: ListView Context Menu Pin
kanchoette26-Aug-09 1:49
kanchoette26-Aug-09 1:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.