Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System / compmod / system / codedom / CodeTypeDelegate.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="CodeTypeDelegate.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.Reflection;
16     using System.Runtime.InteropServices;
17     using System.Runtime.Serialization;
18
19     /// <devdoc>
20     ///    <para>
21     ///       Represents a class or nested class.
22     ///    </para>
23     /// </devdoc>
24     [
25         ClassInterface(ClassInterfaceType.AutoDispatch),
26         ComVisible(true),
27         Serializable,
28     ]
29     public class CodeTypeDelegate : CodeTypeDeclaration {
30         private CodeParameterDeclarationExpressionCollection parameters = new CodeParameterDeclarationExpressionCollection();
31         private CodeTypeReference returnType;
32
33         /// <devdoc>
34         ///    <para>
35         ///       Initializes a new instance of <see cref='System.CodeDom.CodeTypeDelegate'/>.
36         ///    </para>
37         /// </devdoc>
38         public CodeTypeDelegate() {
39             TypeAttributes &= ~TypeAttributes.ClassSemanticsMask;
40             TypeAttributes |= TypeAttributes.Class;
41             BaseTypes.Clear();
42             BaseTypes.Add(new CodeTypeReference("System.Delegate"));
43         }
44
45         /// <devdoc>
46         ///    <para>
47         ///       Initializes a new instance of <see cref='System.CodeDom.CodeTypeDelegate'/>.
48         ///    </para>
49         /// </devdoc>
50         public CodeTypeDelegate(string name) : this() {
51             Name = name;
52         }
53
54         /// <devdoc>
55         ///    <para>
56         ///       Gets or sets the return type of the delegate.
57         ///    </para>
58         /// </devdoc>
59         public CodeTypeReference ReturnType {
60             get {
61                 if (returnType == null) {
62                     returnType = new CodeTypeReference("");
63                 }
64                 return returnType;
65             }
66             set {
67                 returnType = value;
68             }
69         }
70
71         /// <devdoc>
72         ///    <para>
73         ///       The parameters of the delegate.
74         ///    </para>
75         /// </devdoc>
76         public CodeParameterDeclarationExpressionCollection Parameters {
77             get {
78                 return parameters;
79             }
80         }
81     }
82 }