+3  A: 

You'll need to define a base class PrintJob and have PDFSetting as a property of that.

Then define WordPrintJob, ExcelPrintJob etc. to be subclasses of PrintJob.

It's a long time since I've done this so I can't remember off hand whether you'll be able to access PDFSettings from the sub class or if you'll have to cast the variable to the base class first.

ChrisF
+2  A: 

Chris is essentially correct so your switch statement would look thus::

PrintJob oPrintJob = null;
switch (type)
{
    case convert2pdf.ConvertFileType.Word: 
        oPrintJob = new WordPrintJob(); 
        break;
    case convert2pdf.ConvertFileType.Excel: 
        oPrintJob = new ExcelPrintJob(); 
        break;
    case convert2pdf.ConvertFileType.PowerPoint: 
        oPrintJob = new PowerPointPrintJob(); 
        break;
    case convert2pdf.ConvertFileType.IE: 
        oPrintJob = new IEPrintJob(); 
        break;
    case convert2pdf.ConvertFileType.Publisher: 
        oPrintJob = new PublisherPrintJob(); 
        break;
    case convert2pdf.ConvertFileType.Visio: 
        oPrintJob = new VisioPrintJob(); 
        break;
    default: 
        oPrintJob = new GenericPrintJob();
        break;
}

The PDFSettings property would be defined in your base PrintJob class and each of the specific print job classes would inherit from that base class.

Lazarus
+1 for the code. I never cease to be amazed by how much I forget if I don't use it on a daily basis!
ChrisF
tried the Interface, but I don't get how to get this right, how do I create a method that can return all those types?
balexandre
As chills42 says, the method will always return PrintJob. Sounds like you may need a brief refresher on object oriented development. Inheritance and Polymorphism are the keywords for you here.
Lazarus
Yes I do ... back to the reading ... thxs for the help! It is very appreciated
balexandre
+1  A: 

Along with Lazurus's answer, you may also want to create an Interface, and do most of your coding against it, instead of the base class.

chills42
tried the Interface, but I don't get how to get this right, how do I create a method that can return all those types?
balexandre
You don't. You return the base type. Let polymorphism do the dirty work.
toast
As Lazarus said... I need to go back to the reading ... thxs for the help! It is very appreciated
balexandre