The Labs \ Source Viewer \ SSCLI \ System.CodeDom \ CodeTryCatchFinallyStatement

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CodeTryCatchFinallyStatement.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.CodeDom
  16. {
  17.    
  18.     using System.Diagnostics;
  19.     using System;
  20.     using Microsoft.Win32;
  21.     using System.Collections;
  22.     using System.Runtime.InteropServices;
  23.    
  24.     /// <devdoc>
  25.     /// Represents a try block, with any number of catch clauses and an
  26.     /// optionally finally block.
  27.     /// </devdoc>
  28.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  29.     public class CodeTryCatchFinallyStatement : CodeStatement
  30.     {
  31.         private CodeStatementCollection tryStatments = new CodeStatementCollection();
  32.         private CodeStatementCollection finallyStatments = new CodeStatementCollection();
  33.         private CodeCatchClauseCollection catchClauses = new CodeCatchClauseCollection();
  34.        
  35.         /// <devdoc>
  36.         /// <para>
  37.         /// Initializes a new instance of <see cref='System.CodeDom.CodeTryCatchFinallyStatement'/>.
  38.         /// </para>
  39.         /// </devdoc>
  40.         public CodeTryCatchFinallyStatement()
  41.         {
  42.         }
  43.        
  44.         /// <devdoc>
  45.         /// <para>
  46.         /// Initializes a new instance of <see cref='System.CodeDom.CodeTryCatchFinallyStatement'/> using the specified statements to try and catch
  47.         /// clauses.
  48.         /// </para>
  49.         /// </devdoc>
  50.         public CodeTryCatchFinallyStatement(CodeStatement[] tryStatements, CodeCatchClause[] catchClauses)
  51.         {
  52.             TryStatements.AddRange(tryStatements);
  53.             CatchClauses.AddRange(catchClauses);
  54.         }
  55.        
  56.         /// <devdoc>
  57.         /// <para>
  58.         /// Initializes a new instance of <see cref='System.CodeDom.CodeTryCatchFinallyStatement'/> using the specified statements to
  59.         /// try, catch clauses, and finally statements.
  60.         /// </para>
  61.         /// </devdoc>
  62.         public CodeTryCatchFinallyStatement(CodeStatement[] tryStatements, CodeCatchClause[] catchClauses, CodeStatement[] finallyStatements)
  63.         {
  64.             TryStatements.AddRange(tryStatements);
  65.             CatchClauses.AddRange(catchClauses);
  66.             FinallyStatements.AddRange(finallyStatements);
  67.         }
  68.        
  69.         /// <devdoc>
  70.         /// <para>
  71.         /// Gets or sets
  72.         /// the try statements to try.
  73.         /// </para>
  74.         /// </devdoc>
  75.         public CodeStatementCollection TryStatements {
  76.             get { return tryStatments; }
  77.         }
  78.        
  79.         /// <devdoc>
  80.         /// <para>
  81.         /// Gets or sets the catch clauses to use.
  82.         /// </para>
  83.         /// </devdoc>
  84.         public CodeCatchClauseCollection CatchClauses {
  85.             get { return catchClauses; }
  86.         }
  87.        
  88.         /// <devdoc>
  89.         /// <para>
  90.         /// Gets or sets
  91.         /// the finally statements to use.
  92.         /// </para>
  93.         /// </devdoc>
  94.         public CodeStatementCollection FinallyStatements {
  95.             get { return finallyStatments; }
  96.         }
  97.     }
  98. }

Developer Fusion