If I instantiate a Uri
that refers to a path where no file exists, I'd like it to throw an error but it doesn't. And nothing I do with such a Uri
seems to throw an error either.
var bi = new BitmapImage(new Uri("vignette.png", UriKind.Relative));
Is there any way to get it to throw an error? Or is there a way to check if the file exists like with File.Exists()
but using a Uri
object instead of a string
?
This is not a duplicate of C# How can I check if a URL exists/is valid? because my question pertains specifically to testing a C# Uri
object. I'm already aware of how to check if a file exists using a string representation of its path.