all groups > vj# > december 2003 >
You're in the

vj#

group:

throws


throws Abc
12/22/2003 12:25:40 AM
vj#:
How to use throws clause in static functions in j#.
I got following error when trying to use that in a
static function.
'System.ApplicationException' cannot be thrown by static
initializer or static field initializer


RE: throws gijov.vjcr NO[at]SPAM online.microsoft.com
12/22/2003 10:43:50 AM
Hi,

This behavior is as per the language specs.

'System.ApplicationException' is a checked exception.
Static initializer or static field must not result in checked exception.
If one does, a compile time error occurs.

The workaround can by using explicit try catch blocks inside the static
function.

-Gijo Varghese
Visual J# Product Team.
--------------------
[quoted text, click to view]


---------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
RE: throws gijov.vjcr NO[at]SPAM online.microsoft.com
12/29/2003 4:25:46 AM
Hi,
I am closing this thread as per my previous posting.
Hope this clarifed your scenario.
Please get back to us if you need further clarifications on this.

Gijo Varghese
Visual J# Product Team.
---------------------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
AddThis Social Bookmark Button