I want to store an error in an array, but when I try this it tells me
System.IO.DirectoryNotFoundException is a type, which is not valid in the given context.
Type[] errorArray = new Type[] { System.IO.DirectoryNotFoundException };
Am I doing something wrong, or is it not possible this way?
What you want to do is use typeof().
Type[] errorArray = new Type[] { typeof(System.IO.DirectoryNotFoundException) };
This way you store the type of your exception.
1.4m articles
1.4m replys
5 comments
57.0k users