CodeCatchClause.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // System.CodeDom CodeCatchClaus Class implementation
  3. //
  4. // Author:
  5. // Miguel de Icaza ([email protected])
  6. // Daniel Stodden ([email protected])
  7. //
  8. // (C) 2001 Ximian, Inc.
  9. //
  10. using System.Runtime.InteropServices;
  11. namespace System.CodeDom
  12. {
  13. [Serializable]
  14. [ClassInterface(ClassInterfaceType.AutoDispatch)]
  15. [ComVisible(true)]
  16. public class CodeCatchClause
  17. {
  18. private CodeTypeReference catchExceptionType;
  19. private string localName;
  20. private CodeStatementCollection statements;
  21. //
  22. // Constructors
  23. //
  24. public CodeCatchClause ()
  25. {
  26. }
  27. public CodeCatchClause ( string localName )
  28. {
  29. this.localName = localName;
  30. }
  31. public CodeCatchClause ( string localName,
  32. CodeTypeReference catchExceptionType )
  33. {
  34. this.localName = localName;
  35. this.catchExceptionType = catchExceptionType;
  36. }
  37. public CodeCatchClause ( string localName,
  38. CodeTypeReference catchExceptionType,
  39. CodeStatement[] statements )
  40. {
  41. this.localName = localName;
  42. this.catchExceptionType = catchExceptionType;
  43. this.Statements.AddRange( statements );
  44. }
  45. //
  46. // Properties
  47. //
  48. public CodeTypeReference CatchExceptionType {
  49. get {
  50. return catchExceptionType;
  51. }
  52. set {
  53. catchExceptionType = value;
  54. }
  55. }
  56. public string LocalName {
  57. get {
  58. return localName;
  59. }
  60. set {
  61. localName = value;
  62. }
  63. }
  64. public CodeStatementCollection Statements {
  65. get {
  66. if ( statements == null )
  67. statements = new CodeStatementCollection();
  68. return statements;
  69. }
  70. }
  71. }
  72. }