I am new to programming to kindly bear me. I using c sharp, .net 4, VS 2010
I have a interface class called IHandler
with method IsValidate()
.
I have a message like AMOUNT 50 22.4
, where AMOUNT
is identifier.
So format of messages can be like FLOW 12 33 23.1
, again where FLOW
is identifier.
Now, based on the identifier i have different classes like ( I have around 15 - 20 classes like this, as i have to validate different message formats and sequence)
AmountValidator
FlowValidator
In these classes i have implementation of IsValidate()
method, as these implement IHandler
class.
Now my question is, once i identify the identifier of my message like AMOUNT
or FLOW
i want to create instance of the class.
What is the best way to do this?( I don't want to create 30 instances in, if else statement )
Appreciate any help.