This may not the worded quite right but here goes anyway.
If I have the following statements;
DocumentMerger<EmailMerge> mailMerge = new DocumentMerger<EmailMerge>();
List<MailMessage> mailMessages = mailMerge.Process();
DocumentMerger<SmsMerge> mailMerge = new DocumentMerger<SmsMerge>();
List<SmsMessage> smsMessages = mailMerge.Process();
How can I create a generic class that takes a type as its generic such as EmailMerge
and returns either a list of MailMessage or SmsMessage objects?
I have a class called DocumentMerger which creates my object EmailMerge or SmsMerge.
I now need both of them to expose a Process method which returns its own unique list of objects such as List<MaileMessage>
or List<SmsMessage>
I suspect proxies might be the go here but can't work out the code.
Please re-title this question if you think it's not clear enough.