Follow @endyourif rss Facebook LinkedIn

Understanding IndexOutOfRangeException and ArgumentOutOfRangeException

Published on Mar 2, 2020

You've received the following error: Index was outside the bounds of the array with an IndexOutOfRangeException or you received: An exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll but was not handled in user code Additional information: Index was out of range. Must be non-negative and less than the size of the collection with an ArgumentOutOfRangeException. So what gives? Here is what you need to know.

Catching multiple exceptions with C#

Published on Jan 26, 2020

Try/catch blocks are a part of my everyday life. But I'm not a fan of catching all exceptions. I prefer handling only the ones I expect to be thrown in specific situations. Of course I can accomplish this with multiple catch blocks, but when they all do common things I would like a simpler way to avoid code duplication.