1 //------------------------------------------------------------------------------
2 // <copyright file="CodeAttachEventStatement.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;
19 /// Represents a event attach statement.
23 ClassInterface(ClassInterfaceType.AutoDispatch),
27 public class CodeAttachEventStatement : CodeStatement {
28 private CodeEventReferenceExpression eventRef;
29 private CodeExpression listener;
33 /// Initializes a new instance of <see cref='System.CodeDom.CodeAttachEventStatement'/>.
36 public CodeAttachEventStatement() {
41 /// Initializes a new instance of the <see cref='System.CodeDom.CodeAttachEventStatement'/> class using the specified arguments.
44 public CodeAttachEventStatement(CodeEventReferenceExpression eventRef, CodeExpression listener) {
45 this.eventRef = eventRef;
46 this.listener = listener;
50 /// <para>[To be supplied.]</para>
52 public CodeAttachEventStatement(CodeExpression targetObject, string eventName, CodeExpression listener) {
53 this.eventRef = new CodeEventReferenceExpression(targetObject, eventName);
54 this.listener = listener;
59 /// The event to attach a listener to.
62 public CodeEventReferenceExpression Event {
64 if (eventRef == null) {
65 return new CodeEventReferenceExpression();
79 public CodeExpression Listener {