c# - how can i use generic to PdfPcells -


i'm using itextsharp generate table , want make generic of pdfcells instead of adding manually

pdfpcell headcell0 = new pdfpcell(new paragraph("fullname", htitle)); headcell0.backgroundcolor = color.light_gray; pdfpcell headcell1 = new pdfpcell(new paragraph("username", htitle)); headcell1.backgroundcolor = color.light_gray; pdfpcell headcell2 = new pdfpcell(new paragraph("email", htitle)); headcell2.backgroundcolor = color.light_gray; pdfpcell headcell3 = new pdfpcell(new paragraph("department", htitle)); headcell3.backgroundcolor = color.light_gray; pdfpcell headcell4 = new pdfpcell(new paragraph("addedby", htitle)); headcell4.backgroundcolor = color.light_gray; pdfpcell headcell5 = new pdfpcell(new paragraph("account type", htitle)); headcell5.backgroundcolor = color.light_gray; 

if @alexis pigeon's comment isn't you're looking how wrapper function?

public static pdfpcell makeheader(string text, itextsharp.text.font htitle) {     pdfpcell headcell = new pdfpcell(new paragraph(text, htitle));     headcell.backgroundcolor = itextsharp.text.color.light_gray;      return headcell; }  pdfpcell headcell0 = makeheader("fullname", htitle); 

Comments