Well, I want to open pdf file whose name contains certain string.
this is a code that I used to see is there a file whose name contains a string:
if (Directory.EnumerateFiles(startInfo.Arguments).Any(PDFfile=>PDFfile.Contains(myString)))
{
MessageBox.Show("Jackpot");
}
else
{
MessageBox.Show("There is no file!");
}
I get “Jackpot” msg, now how to open that file?! I know that I should use:
Process.Start(startInfo);
But this is when you have exactly specified path to the file.
You could do it a few ways, one way could be this:
Note that the
FirstOrDefaultwould cause it to grab the first result it comes to, unsure if this is the result you are looking for.