Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System / compmod / system / codedom / CodeDelegateCreateExpression.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="CodeDelegateCreateExpression.cs" company="Microsoft">
3 // 
4 // <OWNER>Microsoft</OWNER>
5 //     Copyright (c) Microsoft Corporation.  All rights reserved.
6 // </copyright>                                                                
7 //------------------------------------------------------------------------------
8
9 namespace System.CodeDom {
10
11     using System.Diagnostics;
12     using System;
13     using Microsoft.Win32;
14     using System.Collections;
15     using System.Runtime.InteropServices;
16
17     /// <devdoc>
18     ///    <para>
19     ///       Represents a delegate creation expression.
20     ///    </para>
21     /// </devdoc>
22     [
23         ClassInterface(ClassInterfaceType.AutoDispatch),
24         ComVisible(true),
25         Serializable,
26     ]
27     public class CodeDelegateCreateExpression : CodeExpression {
28         private CodeTypeReference delegateType;
29         private CodeExpression targetObject;
30         private string methodName;
31
32         /// <devdoc>
33         ///    <para>
34         ///       Initializes a new instance of <see cref='System.CodeDom.CodeDelegateCreateExpression'/>.
35         ///    </para>
36         /// </devdoc>
37         public CodeDelegateCreateExpression() {
38         }
39
40         /// <devdoc>
41         ///    <para>
42         ///       Initializes a new instance of <see cref='System.CodeDom.CodeDelegateCreateExpression'/>.
43         ///    </para>
44         /// </devdoc>
45         public CodeDelegateCreateExpression(CodeTypeReference delegateType, CodeExpression targetObject, string methodName) {
46             this.delegateType = delegateType;
47             this.targetObject = targetObject;
48             this.methodName = methodName;
49         }
50
51         /// <devdoc>
52         ///    <para>
53         ///       Gets or sets the delegate type.
54         ///    </para>
55         /// </devdoc>
56         public CodeTypeReference DelegateType {
57             get {
58                 if (delegateType == null) {
59                     delegateType = new CodeTypeReference("");
60                 }
61                 return delegateType;
62             }
63             set {
64                 delegateType = value;
65             }
66         }
67
68         /// <devdoc>
69         ///    <para>
70         ///       Gets or sets the target object.
71         ///    </para>
72         /// </devdoc>
73         public CodeExpression TargetObject {
74             get {
75                 return targetObject;
76             }
77             set {
78                 targetObject = value;
79             }
80         }
81
82         /// <devdoc>
83         ///    <para>
84         ///       Gets or sets the method name.
85         ///    </para>
86         /// </devdoc>
87         public string MethodName {
88             get {
89                 return (methodName == null) ? string.Empty : methodName;
90             }
91             set {
92                 methodName = value;
93             }
94         }
95     }
96 }