1 //------------------------------------------------------------------------------
2 // <copyright file="CodeCatchClause.cs" company="Microsoft">
4 // <OWNER>Microsoft</OWNER>
5 // Copyright (c) Microsoft Corporation. All rights reserved.
7 //------------------------------------------------------------------------------
9 namespace System.CodeDom {
11 using System.Diagnostics;
13 using Microsoft.Win32;
14 using System.Collections;
15 using System.Runtime.InteropServices;
18 /// <para>Represents a catch exception block.</para>
21 ClassInterface(ClassInterfaceType.AutoDispatch),
25 public class CodeCatchClause {
26 private CodeStatementCollection statements;
27 private CodeTypeReference catchExceptionType;
28 private string localName;
32 /// Initializes an instance of <see cref='System.CodeDom.CodeCatchClause'/>.
35 public CodeCatchClause() {
39 /// <para>[To be supplied.]</para>
41 public CodeCatchClause(string localName) {
42 this.localName = localName;
46 /// <para>[To be supplied.]</para>
48 public CodeCatchClause(string localName, CodeTypeReference catchExceptionType) {
49 this.localName = localName;
50 this.catchExceptionType = catchExceptionType;
54 /// <para>[To be supplied.]</para>
56 public CodeCatchClause(string localName, CodeTypeReference catchExceptionType, params CodeStatement[] statements) {
57 this.localName = localName;
58 this.catchExceptionType = catchExceptionType;
59 Statements.AddRange(statements);
63 /// <para>[To be supplied.]</para>
65 public string LocalName {
67 return (localName == null) ? string.Empty: localName;
75 /// <para>[To be supplied.]</para>
77 public CodeTypeReference CatchExceptionType {
79 if (catchExceptionType == null) {
80 catchExceptionType = new CodeTypeReference(typeof(System.Exception));
82 return catchExceptionType;
85 catchExceptionType = value;
91 /// Gets or sets the statements within the clause.
94 public CodeStatementCollection Statements {
96 if (statements == null) {
97 statements = new CodeStatementCollection();