Reputation: 4841
Is there an exception that I can use for when there are one or more files not found?
I'm doing this: filePaths.Where(file => !file.Exists);
and I need to throw some kind of FilesNotFound exception. Do I need to inherit from Exception and make my own exception class?
I'm using C# .NET 4.
Upvotes: 2
Views: 118
Reputation: 9936
There is already a FileNotFoundException in .NET that you can use if you didn't want to write your own. It only relates to one file though, but you could always inherit it and write a FilesNotFoundException
to cater for more than one file
Upvotes: 1
Reputation: 22158
It sounds like you should should inherit from System.IO.IOException and expose a Files property on it.
Upvotes: 2