I am creating a printer class that will print both HTML lines and HTML documents. So basically this can happen:
Printer.Print("<b>Hello world</b>");
and
Printer.Print(@"C:\hello.html");
Therefore, when designing my class, I determine the definition of the printing method between the following:
public static void Print(string inputString, string mode){ if(mode=="htmlString"){
or
public static void Print(string inputString){ if(file.Exists(inputString)){
Overall, which is better? The first option requires a different argument, which is small, but if we use the second option, if we intend to actually print the file, but use the wrong file name, it will print the wrong one.
source share