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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CodeDelegateCreateExpression.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.Runtime.InteropServices;
  23.    
  24.     /// <devdoc>
  25.     /// <para>
  26.     /// Represents a delegate creation expression.
  27.     /// </para>
  28.     /// </devdoc>
  29.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  30.     public class CodeDelegateCreateExpression : CodeExpression
  31.     {
  32.         private CodeTypeReference delegateType;
  33.         private CodeExpression targetObject;
  34.         private string methodName;
  35.        
  36.         /// <devdoc>
  37.         /// <para>
  38.         /// Initializes a new instance of <see cref='System.CodeDom.CodeDelegateCreateExpression'/>.
  39.         /// </para>
  40.         /// </devdoc>
  41.         public CodeDelegateCreateExpression()
  42.         {
  43.         }
  44.        
  45.         /// <devdoc>
  46.         /// <para>
  47.         /// Initializes a new instance of <see cref='System.CodeDom.CodeDelegateCreateExpression'/>.
  48.         /// </para>
  49.         /// </devdoc>
  50.         public CodeDelegateCreateExpression(CodeTypeReference delegateType, CodeExpression targetObject, string methodName)
  51.         {
  52.             this.delegateType = delegateType;
  53.             this.targetObject = targetObject;
  54.             this.methodName = methodName;
  55.         }
  56.        
  57.         /// <devdoc>
  58.         /// <para>
  59.         /// Gets or sets the delegate type.
  60.         /// </para>
  61.         /// </devdoc>
  62.         public CodeTypeReference DelegateType {
  63.             get {
  64.                 if (delegateType == null) {
  65.                     delegateType = new CodeTypeReference("");
  66.                 }
  67.                 return delegateType;
  68.             }
  69.             set { delegateType = value; }
  70.         }
  71.        
  72.         /// <devdoc>
  73.         /// <para>
  74.         /// Gets or sets the target object.
  75.         /// </para>
  76.         /// </devdoc>
  77.         public CodeExpression TargetObject {
  78.             get { return targetObject; }
  79.             set { targetObject = value; }
  80.         }
  81.        
  82.         /// <devdoc>
  83.         /// <para>
  84.         /// Gets or sets the method name.
  85.         /// </para>
  86.         /// </devdoc>
  87.         public string MethodName {
  88.             get { return (methodName == null) ? string.Empty : methodName; }
  89.             set { methodName = value; }
  90.         }
  91.     }
  92. }

Developer Fusion