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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CodeTypeMember.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 member.
  29.     /// </para>
  30.     /// </devdoc>
  31.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  32.     public class CodeTypeMember : CodeObject
  33.     {
  34.         private MemberAttributes attributes = MemberAttributes.Private | MemberAttributes.Final;
  35.         private string name;
  36.         private CodeCommentStatementCollection comments = new CodeCommentStatementCollection();
  37.         private CodeAttributeDeclarationCollection customAttributes = null;
  38.         private CodeLinePragma linePragma;
  39.        
  40.         // Optionally Serializable
  41.         [OptionalField()]
  42.         private CodeDirectiveCollection startDirectives = null;
  43.         [OptionalField()]
  44.         private CodeDirectiveCollection endDirectives = null;
  45.        
  46.        
  47.         /// <devdoc>
  48.         /// <para>
  49.         /// Gets or sets
  50.         /// the name of the member.
  51.         /// </para>
  52.         /// </devdoc>
  53.         public string Name {
  54.             get { return (name == null) ? string.Empty : name; }
  55.             set { name = value; }
  56.         }
  57.        
  58.         /// <devdoc>
  59.         /// <para>
  60.         /// Gets or sets a <see cref='System.CodeDom.MemberAttributes'/> indicating
  61.         /// the attributes of the member.
  62.         /// </para>
  63.         /// </devdoc>
  64.         public MemberAttributes Attributes {
  65.             get { return attributes; }
  66.             set { attributes = value; }
  67.         }
  68.        
  69.         /// <devdoc>
  70.         /// <para>
  71.         /// Gets or sets a <see cref='System.CodeDom.CodeAttributeDeclarationCollection'/> indicating
  72.         /// the custom attributes of the
  73.         /// member.
  74.         /// </para>
  75.         /// </devdoc>
  76.         public CodeAttributeDeclarationCollection CustomAttributes {
  77.             get {
  78.                 if (customAttributes == null) {
  79.                     customAttributes = new CodeAttributeDeclarationCollection();
  80.                 }
  81.                 return customAttributes;
  82.             }
  83.             set { customAttributes = value; }
  84.         }
  85.        
  86.         /// <devdoc>
  87.         /// <para>
  88.         /// The line the statement occurs on.
  89.         /// </para>
  90.         /// </devdoc>
  91.         public CodeLinePragma LinePragma {
  92.             get { return linePragma; }
  93.             set { linePragma = value; }
  94.         }
  95.        
  96.         /// <devdoc>
  97.         /// <para>
  98.         /// Gets or sets the member comment collection members.
  99.         /// </para>
  100.         /// </devdoc>
  101.         public CodeCommentStatementCollection Comments {
  102.             get { return comments; }
  103.         }
  104.        
  105.         public CodeDirectiveCollection StartDirectives {
  106.             get {
  107.                 if (startDirectives == null) {
  108.                     startDirectives = new CodeDirectiveCollection();
  109.                 }
  110.                 return startDirectives;
  111.             }
  112.         }
  113.        
  114.         public CodeDirectiveCollection EndDirectives {
  115.             get {
  116.                 if (endDirectives == null) {
  117.                     endDirectives = new CodeDirectiveCollection();
  118.                 }
  119.                 return endDirectives;
  120.             }
  121.         }
  122.     }
  123. }

Developer Fusion