views:

28

answers:

2

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.

+1  A: 

It sounds like you should should inherit from System.IO.IOException and expose a Files property on it.

Steve Danner
+1  A: 

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

w69rdy