Nathan Hastings
Nathan Hastings

Reputation: 45

VB.NET Throws Exception

In Java you can mark a method as might throw an exception e.g. 'public void foo() throws exception {' This is useful as the developer can then see to putting that method in a try catch block.

Is there a way to do this in VB.NET so that Visual Studio (as in Eclipse) warns the developer to put this code in a try catch block?

Upvotes: 0

Views: 667

Answers (1)

squelos
squelos

Reputation: 1189

There is no equivalent. Its pretty stupid actually, because exceptions should be exceptionnal.

Just add it in the XML documentation.

Dont forget that the throws in Java forces the calling method to surround the call by a try catch bloc ...

Upvotes: 1

Related Questions