Jon Jagger
jon@jaggersoft.com
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 12 Variablesprevious at this levelnext at this level 12.3 Definite assignmentprevious at this levelnext at this level 12.3.3 Precise rules for determining definite assignmentprevious at this levelnext at this level 12.3.3.15 Try-catch-finally statements Paragraph 11 Definite assignment analysis for a try-catch-finally statement of the form:
try try-block   
catch(...) catch-block-1  
...  
catch(...) catch-block-n  
finally finally-block  
is done as if the statement were a try-finally statement enclosing a try-catch statement:
try {  
   try try-block   
   catch(...) catch-block-1  
   ...  
   catch(...) catch-block-n  
}  
finally finally-block  
[Example: The following example demonstrates how the different blocks of a try statement (§15.10) affect definite assignment.
class A  
{  
   static void F() {  
      int i, j;  
      try {  
         goto LABEL:  
         // neither i nor j definitely assigned  
         i = 1;  
         // i definitely assigned  
      }  
      catch {  
         // neither i nor j definitely assigned  
         i = 3;  
         // i definitely assigned  
      }  
      finally {  
         // neither i nor j definitely assigned  
         j = 5;  
         // j definitely assigned  
      }  
      // i and j definitely assigned  
      LABEL:  
      // j definitely assigned  
      
   }  
}  
end example]
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS