The Labs \ Source Viewer \ SSCLI \ System.CodeDom \ CodeTypeDelegate

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CodeTypeDelegate.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.CodeDom
  16. {
  17.    
  18.     using System.Diagnostics;
  19.     using System;
  20.     using Microsoft.Win32;
  21.     using System.Collections;
  22.     using System.Reflection;
  23.     using System.Runtime.InteropServices;
  24.     using System.Runtime.Serialization;
  25.    
  26.     /// <devdoc>
  27.     /// <para>
  28.     /// Represents a class or nested class.
  29.     /// </para>
  30.     /// </devdoc>
  31.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  32.     public class CodeTypeDelegate : CodeTypeDeclaration
  33.     {
  34.         private CodeParameterDeclarationExpressionCollection parameters = new CodeParameterDeclarationExpressionCollection();
  35.         private CodeTypeReference returnType;
  36.        
  37.         /// <devdoc>
  38.         /// <para>
  39.         /// Initializes a new instance of <see cref='System.CodeDom.CodeTypeDelegate'/>.
  40.         /// </para>
  41.         /// </devdoc>
  42.         public CodeTypeDelegate()
  43.         {
  44.             TypeAttributes &= ~TypeAttributes.ClassSemanticsMask;
  45.             TypeAttributes |= TypeAttributes.Class;
  46.             BaseTypes.Clear();
  47.             BaseTypes.Add(new CodeTypeReference("System.Delegate"));
  48.         }
  49.        
  50.         /// <devdoc>
  51.         /// <para>
  52.         /// Initializes a new instance of <see cref='System.CodeDom.CodeTypeDelegate'/>.
  53.         /// </para>
  54.         /// </devdoc>
  55.         public CodeTypeDelegate(string name) : this()
  56.         {
  57.             Name = name;
  58.         }
  59.        
  60.         /// <devdoc>
  61.         /// <para>
  62.         /// Gets or sets the return type of the delegate.
  63.         /// </para>
  64.         /// </devdoc>
  65.         public CodeTypeReference ReturnType {
  66.             get {
  67.                 if (returnType == null) {
  68.                     returnType = new CodeTypeReference("");
  69.                 }
  70.                 return returnType;
  71.             }
  72.             set { returnType = value; }
  73.         }
  74.        
  75.         /// <devdoc>
  76.         /// <para>
  77.         /// The parameters of the delegate.
  78.         /// </para>
  79.         /// </devdoc>
  80.         public CodeParameterDeclarationExpressionCollection Parameters {
  81.             get { return parameters; }
  82.         }
  83.     }
  84. }

Developer Fusion