I have a method in my MVC App that creates a pdf file (takes an object with data to write and path as parameters). I wrote the method in a seperate class and i made it static. In another function on my controler, i call this method like this:
PdfGenerator.GeneratePdfMethod("write this string", "path");
Now if i change this method to non static, i have to instatniate a PdfGenerator object and then call the function on that object:
PdfGenerator p = new PdfGenerator();
p.GeneratePdfMethod("write this string", "path");
Now how can i avoid having to create this object while not making my method static? If it is even possible and advisable?
new PdfGenerator().GeneratePdfMethod("write this string", "path");