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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CodeParameterDeclarationExpression.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 parameter declaration for method, constructor, or property arguments.
  27.     /// </para>
  28.     /// </devdoc>
  29.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  30.     public class CodeParameterDeclarationExpression : CodeExpression
  31.     {
  32.         private CodeTypeReference type;
  33.         private string name;
  34.         private CodeAttributeDeclarationCollection customAttributes = null;
  35.         private FieldDirection dir = FieldDirection.In;
  36.        
  37.        
  38.         /// <devdoc>
  39.         /// <para>
  40.         /// Initializes a new instance of <see cref='System.CodeDom.CodeParameterDeclarationExpression'/>.
  41.         /// </para>
  42.         /// </devdoc>
  43.         public CodeParameterDeclarationExpression()
  44.         {
  45.         }
  46.        
  47.         /// <devdoc>
  48.         /// <para>
  49.         /// Initializes a new instance of <see cref='System.CodeDom.CodeParameterDeclarationExpression'/> using the specified type and name.
  50.         /// </para>
  51.         /// </devdoc>
  52.         public CodeParameterDeclarationExpression(CodeTypeReference type, string name)
  53.         {
  54.             Type = type;
  55.             Name = name;
  56.         }
  57.        
  58.         /// <devdoc>
  59.         /// <para>[To be supplied.]</para>
  60.         /// </devdoc>
  61.         public CodeParameterDeclarationExpression(string type, string name)
  62.         {
  63.             Type = new CodeTypeReference(type);
  64.             Name = name;
  65.         }
  66.        
  67.         /// <devdoc>
  68.         /// <para>[To be supplied.]</para>
  69.         /// </devdoc>
  70.         public CodeParameterDeclarationExpression(Type type, string name)
  71.         {
  72.             Type = new CodeTypeReference(type);
  73.             Name = name;
  74.         }
  75.        
  76.         /// <devdoc>
  77.         /// <para>
  78.         /// Gets or sets the custom attributes for the parameter declaration.
  79.         /// </para>
  80.         /// </devdoc>
  81.         public CodeAttributeDeclarationCollection CustomAttributes {
  82.             get {
  83.                 if (customAttributes == null) {
  84.                     customAttributes = new CodeAttributeDeclarationCollection();
  85.                 }
  86.                 return customAttributes;
  87.             }
  88.             set { customAttributes = value; }
  89.         }
  90.        
  91.         /// <devdoc>
  92.         /// <para>
  93.         /// Gets or sets
  94.         /// the direction of the field.
  95.         /// </para>
  96.         /// </devdoc>
  97.         public FieldDirection Direction {
  98.             get { return dir; }
  99.             set { dir = value; }
  100.         }
  101.        
  102.         /// <devdoc>
  103.         /// <para>
  104.         /// Gets or sets
  105.         /// the type of the parameter.
  106.         /// </para>
  107.         /// </devdoc>
  108.         public CodeTypeReference Type {
  109.             get {
  110.                 if (type == null) {
  111.                     type = new CodeTypeReference("");
  112.                 }
  113.                 return type;
  114.             }
  115.             set { type = value; }
  116.         }
  117.        
  118.         /// <devdoc>
  119.         /// <para>
  120.         /// Gets or sets
  121.         /// the name of the parameter.
  122.         /// </para>
  123.         /// </devdoc>
  124.         public string Name {
  125.             get { return (name == null) ? string.Empty : name; }
  126.             set { name = value; }
  127.         }
  128.     }
  129. }

Developer Fusion