3

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.

0

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.