Il linguaggio C# Eventi ed eccezioni - Dipartimento di Ingegneria ...
Il linguaggio C# Eventi ed eccezioni - Dipartimento di Ingegneria ...
Il linguaggio C# Eventi ed eccezioni - Dipartimento di Ingegneria ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Eccezioni in <strong>C#</strong><br />
Firma dei meto<strong>di</strong> in caso <strong>di</strong> <strong>eccezioni</strong>:<br />
Java<br />
void myMethod() throws IOException {<br />
... throw new IOException(); ...<br />
}<br />
<strong>Il</strong> metodo invocante o<br />
cattura l’eccezione IOException o<br />
specifica IOException nella propria firma<br />
<strong>C#</strong><br />
void myMethod() {<br />
... throw new IOException(); ...<br />
}<br />
il metodo invocante può non gestire l’eccezione.<br />
+ semplice<br />
- meno robusto<br />
A. Longheu – Tecniche <strong>di</strong> programmazione avanzata<br />
24