I have been forced into Java for my job for the last year or so and have been using Intellij IDEA as an IDE.
Coming back to VS I was a bit confused about the Exception Handling in VB.NET.
First question:
Does VB.NET have the ability to add Exceptions to methods?
e.g. in Java you could do this
Can you do this in VB.NET?Code:public void readFile(String fileName) throws IOException { ... ... }
What should you do if you want to throw the exception up the stack?
Second Question:
In IDEA of I don't add the exception to the method at first, then add some code like this:
the IDE tells me that an Exception could be thrown by this block and gives me the option to automatically fix it by surrounding it with a Try/Catch or by adding the exception to the method signature.Code:public void ReadFile(String fileName) { BufferedReader reader = null; new BufferedReader(new FileReader(fileName)); }
Does VS have these automatic detection/fixes?


Reply With Quote


