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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CodeObjectCreateExpression.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 an object create expression.
  27.     /// </para>
  28.     /// </devdoc>
  29.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  30.     public class CodeObjectCreateExpression : CodeExpression
  31.     {
  32.         private CodeTypeReference createType;
  33.         private CodeExpressionCollection parameters = new CodeExpressionCollection();
  34.        
  35.         /// <devdoc>
  36.         /// <para>
  37.         /// Initializes a new <see cref='System.CodeDom.CodeObjectCreateExpression'/>.
  38.         /// </para>
  39.         /// </devdoc>
  40.         public CodeObjectCreateExpression()
  41.         {
  42.         }
  43.        
  44.         /// <devdoc>
  45.         /// <para>
  46.         /// Initializes a new <see cref='System.CodeDom.CodeObjectCreateExpression'/> using the specified type and
  47.         /// parameters.
  48.         /// </para>
  49.         /// </devdoc>
  50.         public CodeObjectCreateExpression(CodeTypeReference createType, params CodeExpression[] parameters)
  51.         {
  52.             CreateType = createType;
  53.             Parameters.AddRange(parameters);
  54.         }
  55.        
  56.         /// <devdoc>
  57.         /// <para>[To be supplied.]</para>
  58.         /// </devdoc>
  59.         public CodeObjectCreateExpression(string createType, params CodeExpression[] parameters)
  60.         {
  61.             CreateType = new CodeTypeReference(createType);
  62.             Parameters.AddRange(parameters);
  63.         }
  64.        
  65.         /// <devdoc>
  66.         /// <para>[To be supplied.]</para>
  67.         /// </devdoc>
  68.         public CodeObjectCreateExpression(Type createType, params CodeExpression[] parameters)
  69.         {
  70.             CreateType = new CodeTypeReference(createType);
  71.             Parameters.AddRange(parameters);
  72.         }
  73.        
  74.         /// <devdoc>
  75.         /// <para>
  76.         /// The type of the object to create.
  77.         /// </para>
  78.         /// </devdoc>
  79.         public CodeTypeReference CreateType {
  80.             get {
  81.                 if (createType == null) {
  82.                     createType = new CodeTypeReference("");
  83.                 }
  84.                 return createType;
  85.             }
  86.             set { createType = value; }
  87.         }
  88.        
  89.         /// <devdoc>
  90.         /// <para>
  91.         /// Gets or sets the parameters to use in creating the
  92.         /// object.
  93.         /// </para>
  94.         /// </devdoc>
  95.         public CodeExpressionCollection Parameters {
  96.             get { return parameters; }
  97.         }
  98.     }
  99. }

Developer Fusion