I have a function in c#, call it
public async Task<byte[]> PrintLetter(int Id)
{
some code here
return byte[2125];
}
I was calling it like this: (not sure what the point of the _ is)
_ = Task.Run(async () => await PrintLetter(cid));
And it was running the print job and working fine.
But now I want to assign this PrintLetter()
to a variable so I can pass along this byte[]
and not just print to printer.
So I wanted to do this:
var files = await PrintLetter(cid);
return Ok(File(files, "application/pdf", "Letter.pdf"));
But I'm nervous to blindly remove the Task.Run
here.
Any advice