To create a pdfDocument I am using following code which works as expected but do not want to use multiple if else. Any patterns or any design strategies? It may  be a over do for the example , but will be useful.string fileExtension = Path.GetExtension(fileName).ToLower();string outPutPath = Path.GetDirectoryName(fileName) + \\ + Path.GetFileNameWithoutExtension(fileName) + .pdf;Aspose.Pdf.Generator.Pdf pdfConverter = new Aspose.Pdf.Generator.Pdf();Section pdfSection = pdfConverter.Sections.Add();//Table pdfTable = new Table() { DefaultCellBorder=new Aspose.Pdf.Generator.BorderInfo((int)BorderSide.All,0.1F)};//pdfSection.Paragraphs.Add(pdfTable);Image sourceImage = new Image();sourceImage.ImageInfo.File = fileName;if (fileExtension == .jpg || fileExtension == .jpeg){    sourceImage.ImageInfo.ImageFileType = ImageFileType.Jpeg;}else if (fileExtension == .bmp){    sourceImage.ImageInfo.ImageFileType = ImageFileType.Bmp;}else if (fileExtension == .gif){    sourceImage.ImageInfo.ImageFileType = ImageFileType.Gif;}else if (fileExtension == .png){    sourceImage.ImageInfo.ImageFileType = ImageFileType.Png;}else if (fileExtension == .tiff){    sourceImage.ImageInfo.ImageFileType = ImageFileType.Tiff;}pdfSection.Paragraphs.Add(sourceImage);pdfConverter.Save(outPutPath);
Classifying image by file extension within a PDF creator
c#;strings;.net;image;pdf